0.1.1 • Published 9 years ago

smart-intervals v0.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

Smart Intervals Circle CI

setInterval replacement for asynchronous tasks

var smartInterval = require('smart-intervals')

interval = smartInterval(1000, function(callback) {
  doAsyncActiviy(callback)
  // interval will be called again 1000ms after doAsyncActiviy calls its callback
})

Methods

interval.stop([callback])

Clears the interval.

If the interval was waiting for the next run it calls the optional callback immediately.

If the interval is waiting for its async function to return it calls the optional callback once the async function finishes

interval.runNow([callback])

Skips waiting for the interval and calls the function immediately if not already running.

Calls the optional callback once the async function finishes

0.1.1

9 years ago

0.1.0

10 years ago

0.0.1

10 years ago