1.0.2 • Published 2 years ago

@pfearr/sleep v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Sleep/Wait Module

  1. Setup a NodeJS file and download the module
npm i @pfearr/sleep
  1. There are 2 ways to use the module effectively using await and .then()
const wait = require("@pfearr/sleep")
async function doStuff(){
    await wait(5000)
    console.log("Bruce, it's been 5 seconds and you still owe me 16 dollars.")
}

OR

const sleep = require("@pfearr/sleep")
sleep(2000).then(()=>{
    console.log("*yawn* That was a nice 2 second sleep.")
})