3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +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.runningIntervals = [];
this.api = { this.api = {
'addTimer': function(callback, timeout, firstDate) { 'addTimer': function(timeout, callback, firstDate) {
var now = new Date().getTime(); var now = new Date().getTime();
if(firstDate) { if(firstDate) {
console.log('Setting first timer to run at ' + firstDate); console.log('Setting first timer to run at ' + firstDate);
firstTimeout = firstDate.getTime() - now; firstTimeout = firstDate.getTime() - now;
setTimeout(function(callback) { setTimeout(function(callback) {
console.log('Running first timer at ' + new Date().toUTCString()); 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(); callback();
}.bind(this), firstTimeout); }.bind(this), firstTimeout);
} else { } else {