1.0.6 • Published 7 years ago
pause-promise v1.0.6
pause
Simple promise wrapper around
setImmediate
,setTimeout
.
Why?
Useful when needing to suspend generator or async functions without doing anything.
const pause = require('pause-promise')
async test () {
const elements = await getSomeArray()
for (const element of elements) {
// do stuff
// hold off for 50 ms until next iteration
await pause(50)
}
}
test()