extra-sleep.web 1.0.6
Install from the command line:
Learn more about npm packages
$ npm install @nodef/extra-sleep.web@1.0.6
Install via package.json:
"@nodef/extra-sleep.web": "1.0.6"
About this version
Sleep for specified time.
π¦ Node.js,
π Web,
π Shell,
π Files,
π° Docs.
sleep is a command in Unix-like operating systems that suspends program execution for specified time. This 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().
This package is available in Node.js, Web, and Shell formats. The web
format is exposed as extra_sleep
standalone variable and can be loaded from
jsDelivr CDN.
Stability: Experimental.
const {sleep} = require('extra-sleep');
async function main() {
console.log('Turn on Alarm');
await sleep(1000);
console.log('Turn on Shower');
}
main();
Property | Description |
---|---|
sleep | Sleep for specified time (async). |
sleepSync | Sleep for specified time. |