Event based interface to setTimeout and setInterval.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

29 lines
510 B

var continuous = require('../');
var run = new continuous({
limit: 20,
time: 500,
callback: function(){
return Math.round(new Date().getTime()/1000.0);
}
});
run.on('started', function(){
console.log('running');
});
run.on('stopped', function(){
console.log('stopped');
});
run.on('complete', function(count,result){
console.log('The count is: ' + count);
console.log('The time is: ' + result);
});
run.start();
setTimeout( function(){
run.stop();
}, 5000 );