1.0.2 • Published 2 years ago
@pfearr/sleep v1.0.2
Sleep/Wait Module
- Setup a NodeJS file and download the module
npm i @pfearr/sleep
- 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.")
})