1.0.1 • Published 9 years ago
nu-sleep v1.0.1
nu-sleep
Asynchronous sleep for adding expected delays to code
Install
npm install nu-sleep
Example
const sleep = require('nu-sleep');
// Promises
function doSomething1 () {
sleep(1000).then(function () {
// Will be executed after 1000 ms.
});
};
// ES7 async/await
async function doSomething2 () {
await sleep(1000);
// Eveything after here will be executed after 1000 ms.
};
License
MIT