Skip to content

nodef/extra-sleep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sleep is a command in Unix-like operating systems that suspends program execution for specified time. This package provides both a synchronous and an asynchronous method for sleeping without doing a busy wait. The synchronous sleep is achieved using Atomics.wait() (1), and the asynchronous one is achived using Promisified setTimeout().

▌ 📦 JSR, 📰 Docs,


import {sleep, sleepSync} from "jsr:@nodef/extra-sleep";


console.log('Turn on Alarm');
await sleep(1000);
console.log('Turn on Shower');
sleepSync(1e+6);  // And relax!


Index

Name Description
sleep Sleep for specified time (async).
sleepSync Sleep for specified time.


References




ORG