Delays the execution of the function by the given amount of time.
If the given time is less than zero, the function resolves after 0 seconds.
If a non-number value is passed in, treat it as 0
Since
v0.0.1
Returns
A promise that resolves after the specified delay.
Example
delay(1000).then(() => { console.log('one second later') })
Example
async () => { awaitdelay(1000) console.log('one second later') }
Parameters
Optional time: number
The amount of time to delay the execution, in milliseconds.
Delays the execution of the function by the given amount of time. If the given time is less than zero, the function resolves after 0 seconds. If a non-number value is passed in, treat it as 0
Since
v0.0.1
Returns
A promise that resolves after the specified delay.
Example
Example