0.1.2 • Published 9 years ago
@koax/timing v0.1.2
timing
Delay, timeout, and interval effects. (Included in koax)
Installation
$ npm install @koax/timing
Usage
import {delay, timeout, interval} from '@koax/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)
}
API
delay(wait)
wait
- time to block
Returns: delay action
timeout(fn, wait)
fn
- function to run afterwait
mswait
- time to wait
Returns: timeout action
interval(fn, wait)
fn
- function to run on an intervalwait
- time in between runs
Returns: interval action
License
MIT