Skip to main content
Version: v2

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)2.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'
import { Time } from '@zos/sensor'

const time = new Time()
const timeoutId = setLaunchAppTimeout({
url: 'pages/js_widget_sample',
appId: 1000001,
utc: time.getTime() + 1000,
})

clearLaunchAppTimeout({
timeoutId,
})