asleep 1.0.3
Non-blocking sleep in ES7 (or, in ES6, setTimeout as a promise).
This is mostly a syntactic alternative to setTimeout in ES6, but in ES7 combined with a loop it will provide a syntactically cleaner alternative to setInterval.
Due to the very limited code base of this module, we do not anticipate needing to make very many changes to it.
Require the module
var asleep = ;
Usage in ES6
// Sleep for 2 seconds (2000 ms), then do something;
Usage in ES7
// Inside any async function:// Sleep for 2 seconds (2000 ms), then do somethingawait ;console;
Example 2
// Inside any type of loop in any async function:while1 await ; console;
Please note: This is non-blocking, other code will continue to run while your async function "sleeps".