Revision edd1d565 ui/static/snf/js/sync.js
b/ui/static/snf/js/sync.js | ||
---|---|---|
215 | 215 |
this._called = 0; |
216 | 216 |
this.interval = undefined; |
217 | 217 |
this.call_on_start = options.call_on_start || true; |
218 |
|
|
219 |
this.running = false; |
|
218 | 220 |
|
219 | 221 |
// wrapper |
220 | 222 |
function _cb() { |
... | ... | |
228 | 230 |
} |
229 | 231 |
this.cb(); |
230 | 232 |
}; |
233 |
|
|
231 | 234 |
_cb = _.bind(_cb, this); |
232 | 235 |
|
233 | 236 |
this.faster = function() { |
... | ... | |
239 | 242 |
this.setInterval = function() { |
240 | 243 |
this.trigger("clear"); |
241 | 244 |
window.clearInterval(this.interval); |
245 |
this.interval = window.setInterval(_cb, this.timeout); |
|
246 |
this.running = true; |
|
242 | 247 |
if (this.call_on_start) { |
243 | 248 |
_cb(); |
244 | 249 |
} |
245 |
this.interval = window.setInterval(_cb, this.timeout); |
|
246 | 250 |
} |
247 | 251 |
|
248 | 252 |
this.start = function () { |
... | ... | |
252 | 256 |
this.stop = function() { |
253 | 257 |
this.trigger("clear"); |
254 | 258 |
window.clearInterval(this.interval); |
259 |
this.running = false; |
|
255 | 260 |
} |
256 | 261 |
} |
257 | 262 |
|
Also available in: Unified diff