Delay, timeout, and interval effects. (Included in flox)
$ npm install @flox/timing
import {delay, timeout, interval} from '@flox/timing'
function * () {
yield delay(500)
// do something later
}
function * () {
yield timeout(doSomethingLater, 500)
// do something now
}
function * () {
let task = yield interval(repeatSomething, 500)
// do something and then cancel
yield cancel(task)
}
wait
- time to block
Returns: delay action
fn
- function to run afterwait
mswait
- time to wait
Returns: timeout action
fn
- function to run on an intervalwait
- time in between runs
Returns: interval action
MIT