extra-sleep.web 0.0.25
Install from the command line:
Learn more about npm packages
$ npm install @nodef/extra-sleep.web@0.0.25
Install via package.json:
"@nodef/extra-sleep.web": "0.0.25"
About this version
Sleep for specified time.
π¦ Node.js,
π Web,
π₯οΈ Shell,
π Files,
π° Docs.
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 fyers = 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. |