Get unlimited public & private packages + team-based management with npm Teams.Learn more »

js-sleep

1.0.0 • Public • Published

NoDependencies Browser Node

Browser & Node, ES7 sleep()

Pauses the execution (without freezing the Browser/thread) the requested ammount of milliseconds.

The implementaton in based in the native Promises, and requires the usage of await.

asymc function main(){
    // some code...
    await sleep(1000);
    // continue execution...
}

Package distribution networks :

In browser enviroment you can include this library using the jsdelivr CDN ...

<script src="https://cdn.rawgit.com/colxi/js-sleep/master/js-sleep.js"></script>

If you are in the NodeJs enviroment, can install and import the package via:

$ npm install js-sleep
// import
const sleep = require('js-sleep');

Install

npm i js-sleep

DownloadsWeekly Downloads

1

Version

1.0.0

License

GPL

Unpacked Size

1.8 kB

Total Files

3

Last publish

Collaborators

  • avatar