0.0.7 • Published 7 years ago

asyncinterval v0.0.7

Weekly downloads
1,000
License
MIT
Repository
github
Last release
7 years ago

Build Status

asyncInterval

Async aware setInterval. Run functions at an interval without overlapping previous calls.

There is also a timeout option to continue the interval incase an async task is stuck.

Installation

$ npm install asyncinterval

Usage

code example:

var asyncInterval = require('asyncinterval');

var interval = asyncInterval(function(done){
    
    // don't worry, we only enter here one call at a time.
    doSomething(function(err){

        // after we finish our async function, let asyncInterval know
        // this will tell asyncInterval to schedule the next interval
        done();
    });
}, 5, 10);

// optional timeout
interval.onTimeout(function(){
    // log timeout here
});

parameters

  • function: the function to call when interval does work, this function will be given done argument.
  • interval: in milliseconds, the internal frequency
  • timeout: in milliseconds, if specified, will stop waiting done to be called and start next interval
0.0.7

7 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago