😴 Suspends execution for a specified number of milliseconds.

Syntax

TypeScript
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

TypeScript
await sleep(1000); // Suspends execution for 1 second

await sleep(0); // Resolves in the next event loop iteration
Last updated on
Edit this page