Skip to main content

Sleep

import { sleep, sleepRandom, sleepSync } from '@rtorcato/js-common/sleep'

Exports

NameSummary
sleepReturns a promise that resolves after the specified number of milliseconds.
sleepRandomReturns a promise that resolves after a random delay between min and max milliseconds.
sleepSyncBlocks the event loop for the specified number of milliseconds (synchronous sleep).
sleepWithAbortReturns a promise that resolves after ms, or rejects if aborted via AbortSignal.