Reliable periodic events.
var periodic = require('periodic');
var ticks = 0;
periodic(1000)
.on('tick', function () {
console.log('tick');
if (++ticks == 10) this.end();
})
Return a new periodic
that emits tick
events every interval
milliseconds.
periodic
tries to stay in time even when the event loop is busy.
Stop emitting.
With npm do
$ npm install periodic
Alternatively, with component do
$ component install juliangruber/periodic
every by chrisdickinson has a nicer name but the overall interface and implementation are too complex for my needs.
(MIT)