3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 05:32:50 +01:00

change param order for timer

This commit is contained in:
reality 2013-01-20 21:57:14 +00:00
parent ff4d1f2021
commit 4f0cfaab93

View File

@ -10,14 +10,14 @@ var timers = function(dbot) {
this.runningIntervals = [];
this.api = {
'addTimer': function(callback, timeout, firstDate) {
'addTimer': function(timeout, callback, firstDate) {
var now = new Date().getTime();
if(firstDate) {
console.log('Setting first timer to run at ' + firstDate);
firstTimeout = firstDate.getTime() - now;
setTimeout(function(callback) {
console.log('Running first timer at ' + new Date().toUTCString());
this.runningIntervals.push(this.api.addTimer(callback, timeout));
this.runningIntervals.push(this.api.addTimer(timeout, callback));
callback();
}.bind(this), firstTimeout);
} else {