1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Remove usage of JX.defer in favor of setTimeout

Summary: -
Test Plan:
This was a pretty straightforward replace. Everything should
be sane.

Reviewed By: epriestley
Reviewers: tomo, epriestley, mroch
CC: aran, epriestley
Differential Revision: 803
This commit is contained in:
cpojer 2011-08-10 17:34:52 -07:00
parent e137080d9c
commit 7571d4c02a
7 changed files with 22 additions and 27 deletions

View file

@ -42,8 +42,7 @@ JX.install('PhabricatorShapedRequest', {
return;
}
this._defer && this._defer.stop();
clearTimeout(this._defer);
var data = this._dataCallback();
if (this.shouldSendRequest(this._last, data)) {
@ -52,10 +51,11 @@ JX.install('PhabricatorShapedRequest', {
this._callback(r);
this._min = new Date().getTime() + this.getRateLimit();
this._defer && this._defer.stop();
this._defer = JX.defer(
clearTimeout(this._defer);
this._defer = setTimeout(
JX.bind(this, this.trigger),
this.getRateLimit());
this.getRateLimit()
);
}));
request.listen('finally', JX.bind(this, function() {
this._request = null;
@ -64,9 +64,10 @@ JX.install('PhabricatorShapedRequest', {
request.setTimeout(this.getRequestTimeout());
request.send();
} else {
this._defer = JX.defer(
this._defer = setTimeout(
JX.bind(this, this.trigger),
this.getFrequency());
this.getFrequency()
);
}
},

View file

@ -39,7 +39,7 @@ JX.behavior('aphront-drag-and-drop', function(config) {
redraw(true);
// This redraws the instructions.
JX.defer(redraw, 1000);
setTimeout(redraw, 1000);
});
drop.start();

View file

@ -173,10 +173,8 @@ JX.behavior('phabricator-object-selector', function(config) {
}
last_value = cur_value;
if (query_timer) {
query_timer.stop();
}
query_timer = JX.defer(sendQuery, query_delay);
clearTimeout(query_timer);
query_timer = setTimeout(sendQuery, query_delay);
});
sendQuery();

View file

@ -24,11 +24,10 @@ JX.behavior('phabricator-watch-anchor', function() {
}
}
JX.Stratcom.listen(
'hashchange',
null,
// Defer invocation so other listeners can update the document.
function() { JX.defer(highlight); });
JX.defer(highlight);
// Defer invocation so other listeners can update the document.
var fn = function() {
setTimeout(highlight, 0);
};
JX.Stratcom.listen('hashchange', null, fn);
fn();
});

View file

@ -42,7 +42,7 @@ JX.behavior('countdown-timer', function(config) {
JX.DOM.setContent(JX.$('phabricator-timer-minutes'), minutes);
JX.DOM.setContent(JX.$('phabricator-timer-seconds'), seconds);
JX.defer(calculateTimeLeft, 1000);
setTimeout(calculateTimeLeft, 1000);
}
});

View file

@ -8,10 +8,8 @@
JX.behavior('diffusion-jump-to', function(config) {
JX.defer(
function() {
window.scrollTo(0, JX.$V(JX.$(config.target)).y - 100);
});
setTimeout(function() {
window.scrollTo(0, JX.$V(JX.$(config.target)).y - 100);
}, 0);
});

View file

@ -98,8 +98,7 @@ JX.install('PathTypeahead', {
this._typeahead.listen(
'choose',
JX.bind(this, function() {
JX.defer(
JX.bind(this._typeahead, this._typeahead.refresh));
setTimeout(JX.bind(this._typeahead, this._typeahead.refresh), 0);
}));
var repo_set_input = JX.bind(this, this._onrepochange);