sleep-deep

Module will implement that functionality which you want to execute after X miliseconds ago

Usage no npm install needed!

<script type="module">
  import sleepDeep from 'https://cdn.skypack.dev/sleep-deep';
</script>

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