@esfx/threading-sleep Package
Provides the sleep(ms) function which causes the current execution thread to sleep until the timeout expires.
Installation
npm i @esfx/threading-sleep
Usage
import { sleep } from "@esfx/threading-sleep";
// block the main thread for half a second
sleep(500);
Functions
sleep(ms)
Causes the current thread of execution to sleep until the specified timeout expires.
Declaration
export declare function sleep(ms: number): void;
Parameters
- ms
- number
The number of milliseconds to suspend the thread. Must be a finite, positive value, or zero.
Returns
void