extra-sleep.web
TypeScript icon, indicating that this package has built-in type declarations

1.0.20 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i extra-sleep.web

Weekly Downloads

0

Version

1.0.20

License

MIT

Unpacked Size

6.84 kB

Total Files

6

Last publish

Collaborators

  • wolfram77