Timing
sleep

😴 Suspends execution for a specified number of milliseconds.

Syntax

import { sleep } from '@opentf/std';
 
sleep(ms: number = 0): Promise<void>;

Parameters

  • ms: The number of milliseconds to sleep. Default: 0.

Returns

A Promise that resolves after the specified delay.

Examples

await sleep(1000); // Suspends execution for 1 second
 
await sleep(0); // Resolves in the next event loop iteration

Related

Try