Skip to content

Commit

Permalink
Update jquery.timer.js
Browse files Browse the repository at this point in the history
Add option for disabled timers.
  • Loading branch information
gaboom committed Mar 18, 2013
1 parent 4feff55 commit d819b57
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jquery.timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if(!callback) { return false; }

timer = function(interval, callback) {
timer = function(interval, callback, disabled) {
// Only used by internal code to call the callback
this.internalCallback = function() { callback(self); };

Expand All @@ -31,7 +31,11 @@

// Set the interval time again
this.interval = interval;
this.id = setInterval(this.internalCallback, this.interval);

// Set the timer, if enabled
if (!disabled) {
this.id = setInterval(this.internalCallback, this.interval);
}

var self = this;
};
Expand Down

0 comments on commit d819b57

Please sign in to comment.