README
Sleep-Deep
Just, Sleep
npm install sleep-deep
const sleep = require('sleep-deep');
sleep(5000) // Sleep ( 5 * 1000 miliseconds )
.then(() => console.log(`I'm awake !`))
.then(eat)
.then(goToWork)
.catch(late)
function eat() {
console.log(`eat !`);
}
function goToWork() {
console.log(`Work !`)
throw new Error("Late!")
}
function late() {
process.stderr.write(`late !`)
}
Reasons to use
- Easy to use
- Use Promises
- Size is only 3 KB
- Simple API to write asynchronous code