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
Property | Type | Required | DefaultValue | Description | API_LEVEL |
---|---|---|---|---|---|
appId | number | Y | - | Mini Program ID | 2.0 |
url | string | Y | - | path | 2.0 |
utc | number | N | - | 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 effect | 2.0 |
delay | number | N | 0 | The time, in milliseconds that the timer should wait before the Mini Program is waked. | 3.0 |
params | string|object | N | - | 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 string | 2.0 |
Result
Type | Description |
---|---|
number | The 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,
})