Pauses execution for the specified number of milliseconds
⚠️ NOTE: Requires an active event loop to function
// In your code:async function main() { console.log('Starting'); await asyncSleep(1000); // Wait for 1 second console.log('Done');}void main();// Make sure you have an event loop running!runOsEventLoop(); Copy
// In your code:async function main() { console.log('Starting'); await asyncSleep(1000); // Wait for 1 second console.log('Done');}void main();// Make sure you have an event loop running!runOsEventLoop();
The number of milliseconds to sleep
Pauses execution for the specified number of milliseconds
⚠️ NOTE: Requires an active event loop to function
See
Example