asyncinterval
v0.0.7
Published
Async aware setInterval. Run functions at an interval without overlapping previous calls.
Maintainers
Readme
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 asyncintervalUsage
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 givendoneargument.interval: in milliseconds, the internal frequencytimeout: in milliseconds, if specified, will stop waitingdoneto be called and start next interval

