Skip to content

sleep

sleep(ms): Promise<void>

Sleeps the cothread for the specified number of millisecond.

Example

await sleep(1_000)
// => sleeps for 1 second

Parameters

ms

number

The amount of milliseconds to sleep.

Returns

Promise<void>

A promise that resolves when the sleep has ended.