Usage
const sleeping = // sync modeconst time1 = Date;sleep;const time2 = Date;;// async modeconst time1 = Date;sleep ;// with callbackconst time1 = Date;sleep; // with async functions async const time1 = Date; asleep sleep const time2 = Date; ;
Install
This method block the nodejs event loop
$ npm install sleeping
API Documentation sleeping -> Object
sleeping.for(delay) -> undefined
the param is the time that is event loop will be blocked
sleeping.forAsync(delay,cb) -> Promise
the param is the time that is event loop will be blocked, if the cb is not given return a promise that is resolved when the block is resolved.