repeatit
v0.1.5
Published
Create multiple repeating timed functions.
Downloads
7
Readme
'use strict';
// Require the package
var rep = require('repeatit');
// Create the functions to be repeated
var f1 = function () {
console.log('message1');
};
var f2 = function () {
console.log('message2');
};
// Create the repeaters, time is in milliseconds and defaults to 1000
var x = rep.createRepeater(f1, 3000);
var y = rep.createRepeater(f2, 1000);
// Start the timers
x.start();
y.start();
// Wait a while then stop the timers.
setTimeout(function () {
x.stop();
y.stop();
}, 20000);