js-sleep
v1.0.0
Published
Pause the execution the specifed number of milliseconds (Browser and Node).
Downloads
5
Maintainers
Readme
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');