Reliable intervals.
var repeat = require('repeated');
var ticks = 0;
repeat(1000)
.on('tick', function () {
console.log('tick');
if (++ticks == 10) this.end();
})
Return a new repeater that emits tick
events every interval
milliseconds.
repeated
tries to stay in time even when the event loop is busy.
Stop repeating.
With npm do
$ npm install repeated
(MIT)