Sleep
lastmod 2024-01-05created 2018-08-202 edits
Infinite wait
Waits indefinitely until a SIGTERM signal is received. Using sleep 1 in a loop wakes the CPU every second, so it is not ideal.
Examples
TypeScript Promise
/**
* Creates a promise that resolves to null after some time.
*/
export async function sleep(time: number): Promise<null> {
return await new Promise((accept) => {
setTimeout(() => accept(null), time)
})
}
Pages that link here