Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 3.04 KB

README.md

File metadata and controls

79 lines (57 loc) · 3.04 KB

Sleep for specified time.
📦 Node.js, 🌐 Web, 🐚 Shell, 📜 Files, 📰 Docs, 📘 Wiki.

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 and Web formats. To use it on the web, simply use the extra_sleep global variable after loading with a <script> tag from the jsDelivr CDN.

Stability: Experimental.


const {sleep} = require('extra-sleep');
// import {sleep} from "extra-sleep";
// import {sleep} from "https://unpkg.com/extra-sleep/index.mjs"; (deno)


async function main() {
  console.log('Turn on Alarm');
  await sleep(1000);
  console.log('Turn on Shower');
}
main();


Index

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


References



ORG DOI Coverage Status Test Coverage Maintainability