Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix cancel() function incorrect behaviour that prevented the loop to …

…be effectively canceled
  • Loading branch information...
commit e7a03b3b32bbea95669eacb08d45ad9cfa7b8384 1 parent a39bb96
@jorgemanrubia jorgemanrubia authored committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 jquery.periodic.js
View
6 jquery.periodic.js
@@ -45,7 +45,8 @@ jQuery.periodic = function (options, callback) {
increment();
// queue up the next run
- run();
+ if(settings.tid)
+ run();
}, settings.cur_period);
}
@@ -81,6 +82,7 @@ jQuery.periodic = function (options, callback) {
function cancel() {
clearTimeout(settings.tid);
+ settings.tid = null;
}
// other functions we might want to implement
@@ -94,4 +96,4 @@ jQuery.periodic.defaults = {
max_period : 1800000, // 30 min.
decay : 1.5, // time period multiplier
on_max : undefined // called if max_period is reached
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.