Skip to content

sleep

The sleep() function creates an asynchronous pause for a number of milliseconds.

Interactive example

Syntax

typescript
function sleep(millieSeconde?: number): Promise<void>;

Parameters

  • millieSeconde : Duration in milliseconds (optional, 0 by default).

Return value

A promise that resolves after the indicated duration.

See also

  • asyncRetry - May use pauses between attempts
  • asyncLoop - Asynchronous loop that can include delays

Released under the MIT license.