Fix Updater.update when it's executed as an event callback.

This commit is contained in:
Nicolas Stepien 2012-03-06 10:50:24 +01:00
parent f38f8fa9e9
commit 1079cf1434
2 changed files with 9 additions and 9 deletions

View File

@ -2691,14 +2691,14 @@
}, },
update: function() { update: function() {
var url, _ref; var url, _ref;
this.timer.textContent = 0; Updater.timer.textContent = 0;
if ((_ref = this.request) != null) _ref.abort(); if ((_ref = Updater.request) != null) _ref.abort();
url = location.pathname + '?' + Date.now(); url = location.pathname + '?' + Date.now();
return this.request = $.ajax(url, { return Updater.request = $.ajax(url, {
onload: this.cb.update onload: Updater.cb.update
}, { }, {
headers: { headers: {
'If-Modified-Since': this.lastModified 'If-Modified-Since': Updater.lastModified
} }
}); });
} }

View File

@ -2251,12 +2251,12 @@ Updater =
@update() @update()
update: -> update: ->
@timer.textContent = 0 Updater.timer.textContent = 0
@request?.abort() Updater.request?.abort()
#fool the cache #fool the cache
url = location.pathname + '?' + Date.now() url = location.pathname + '?' + Date.now()
@request = $.ajax url, onload: @cb.update, Updater.request = $.ajax url, onload: Updater.cb.update,
headers: 'If-Modified-Since': @lastModified headers: 'If-Modified-Since': Updater.lastModified
Watcher = Watcher =
init: -> init: ->