Skip to main content
Version: v2

setTimeout

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Set a timer and execute the registered callback function after the timer expires.

Type

function setTimeout(callback: Callback, delay?: Delay): TimeoutID

Parameters

Callback

TypeDescription
() => unknownCallback functions executed after the timer expires

Delay

TypeDescription
numberThe number of milliseconds to delay the function, default 1ms

TimeoutID

TypeDescription
numberTimer number

Example

setTimeout(() => {
console.log('Hello Zepp OS')
}, 1000)