fn
sleep
v0.0.3testedDelays the execution of the current function by the specified amount of time
Examples
ts
await sleep(1000);ts
sleep(1000).then(() => {
console.log('Hello, World!');
});Signature
ts
export function sleep(ms: number): Promise<void>{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
ms | number | The amount of time to delay the execution of the current function |
Returns
Promise<void>- A promise that resolves after the specified amount of time