1.0.0 • Published 6 years ago

js-sleep v1.0.0

Weekly downloads
1
License
GPL
Repository
github
Last release
6 years ago

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');