Skip to content

Commit 8ee1cbc

Browse files
author
Maurice Snip
committed
Moved spinningTimer to Spinning scope instead of global (shared) scope
1 parent 7b75eb5 commit 8ee1cbc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

js/jquery.spinner.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
factory(jQuery);
2121
}
2222
})(function($) {
23-
var spinningTimer;
2423
var Spinner;
2524
var Spinning = function($element, options) {
2625
this.$el = $element;
2726
this.options = $.extend({}, Spinning.rules.defaults, Spinning.rules[options.rule] || {}, options);
2827
this.min = Number(this.options.min) || 0;
2928
this.max = Number(this.options.max) || 0;
29+
this.spinningTimer = null;
3030

3131
this.$el.on({
3232
'focus.spinner': $.proxy(function(e) {
@@ -99,8 +99,8 @@
9999
this.$el.trigger('changing.spinner', [this.value(), this.oldValue]);
100100

101101
// lazy changed.spinner
102-
clearTimeout(spinningTimer);
103-
spinningTimer = setTimeout($.proxy(function() {
102+
clearTimeout(this.spinningTimer);
103+
this.spinningTimer = setTimeout($.proxy(function() {
104104
this.$el.trigger('changed.spinner', [this.value(), this.oldValue]);
105105
}, this), Spinner.delay);
106106
}

0 commit comments

Comments
 (0)