Skip to main content
Version: v3

setLaunchAppTimeout

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Register a timer to launch the Mini Program at a given time.

Type

function setLaunchAppTimeout(option: Option): Result

Parameters

Option

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
appIdnumberY-Mini Program ID2.0
urlstringY-path2.0
utcnumberN-utc timestamp(milliseconds),the priority is higher than delay, and when set at the same time as the delay field, only the utc field takes effect2.0
delaynumberN0The time, in milliseconds that the timer should wait before the Mini Program is waked.3.0
paramsstring|objectN-The argument passed to the app.js lifecycle onCreate supports either a string or a standard JSON object. If a standard JSON object is passed, the method internally converts it to a string2.0

Result

TypeDescription
numberThe returned value is a positive integer value which identifies the timer created by the call to setLaunchAppTimeout. This value can be passed to clearLaunchAppTimeout to cancel the timeout.

Example

import { setLaunchAppTimeout, clearLaunchAppTimeout } from '@zos/router'

const timeoutId = setLaunchAppTimeout({
url: 'pages/js_widget_sample',
appId: 1000001,
delay: 1000,
})

clearLaunchAppTimeout({
timeoutId,
})