DEV: replaces setTimeout by Ember.run.later (#6618)

This commit is contained in:
Joffrey JAFFEUX 2018-11-19 10:46:38 +01:00 committed by Régis Hanol
parent f2c227432c
commit 907cf3ee2f
8 changed files with 9 additions and 13 deletions

View File

@ -40,7 +40,7 @@ export default Ember.Controller.extend({
);
}
setTimeout(() => {
Ember.run.later(() => {
this.set("model.savingStatus", null);
}, 2000);

View File

@ -786,7 +786,7 @@ export default Ember.Component.extend({
// The paste doesn't finish immediately and we don't have any onpaste
// event, so wait for 100ms which _should_ be enough time.
setTimeout(() => {
Ember.run.later(() => {
const pastedImg = contentEditableDiv.find("img");
if (pastedImg.length === 1) {

View File

@ -16,7 +16,7 @@ export default {
if (!timeoutIsSet && Discourse.get("requiresRefresh")) {
// Since we can do this transparently for people browsing the forum
// hold back the message 24 hours.
setTimeout(function() {
Ember.run.later(() => {
bootbox.confirm(I18n.lookup("assets_changed_confirm"), function(
result
) {

View File

@ -114,7 +114,7 @@ export default {
}
// restore href
setTimeout(() => {
Ember.run.later(() => {
$link.removeClass("no-href");
$link.attr("href", $link.data("href"));
$link.data("href", null);

View File

@ -79,7 +79,7 @@ function confirmNotification() {
const clickEventHandler = () => notification.close();
notification.addEventListener("click", clickEventHandler);
setTimeout(() => {
Ember.run.later(() => {
notification.close();
notification.removeEventListener("click", clickEventHandler);
}, 10 * 1000);
@ -177,7 +177,7 @@ function onNotification(data) {
}
notification.addEventListener("click", clickEventHandler);
setTimeout(function() {
Ember.run.later(() => {
notification.close();
notification.removeEventListener("click", clickEventHandler);
}, 10 * 1000);

View File

@ -130,9 +130,7 @@ export default {
quoteReply() {
this.sendToSelectedPost("replyToPost");
// lazy but should work for now
setTimeout(function() {
$(".d-editor .quote").click();
}, 500);
Ember.run.later(() => $(".d-editor .quote").click(), 500);
},
goToFirstPost() {

View File

@ -86,9 +86,7 @@ function positioningWorkaround($fixedElement) {
fixedElement.style.top = "";
fixedElement.style.height = oldHeight;
setTimeout(() => {
$(fixedElement).removeClass("no-transition");
}, 500);
Ember.run.later(() => $(fixedElement).removeClass("no-transition"), 500);
$(window).scrollTop(originalScrollTop);

View File

@ -395,7 +395,7 @@ export default createWidget("topic-timeline", {
const stream = this.attrs.topic.get("postStream");
// a little debounce to avoid flashing
setTimeout(() => {
Ember.run.later(() => {
if (!this.state.position === pos) {
return;
}