Sleep for n milliseconds
$ npm install @f/sleep
This is particularly useful when programming with generators, e.g.
var sleep = require('@f/sleep')
function * pollThing () {
while (!thingIsReady()) {
yield sleep(100)
}
}
timeInMs
- The time in milliseconds you want to sleep for
Returns: A promise that resolves in timeInMs
milliseconds.
MIT