@flox/timing

0.2.0 • Public • Published

timing

Build status Git tag NPM version Code style

Delay, timeout, and interval effects. (Included in flox)

Installation

$ npm install @flox/timing

Usage

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)
}

API

delay(wait)

  • wait - time to block

Returns: delay action

timeout(fn, wait)

  • fn - function to run after wait ms
  • wait - time to wait

Returns: timeout action

interval(fn, wait)

  • fn - function to run on an interval
  • wait - time in between runs

Returns: interval action

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @flox/timing

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • flox