mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
20 lines
446 B
JavaScript
20 lines
446 B
JavaScript
|
var timers = function() {
|
||
|
var timers = [];
|
||
|
|
||
|
return {
|
||
|
'addTimer': function(interval, callback) { // Because who puts the callback first. Really.
|
||
|
timers.push(setInterval(callback, interval));
|
||
|
},
|
||
|
|
||
|
'clearTimers': function() {
|
||
|
for(var i;i<timers.length;i++) {
|
||
|
clearInterval(timers[i]);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
exports.create = function() {
|
||
|
return timers();
|
||
|
}
|