Revert "Revert Ember.run refactors"

This reverts commit fcb1ca52f9.
This commit is contained in:
Robin Ward
2019-10-30 09:48:24 -04:00
parent 8e6ad99e92
commit 8d34f4bbd9
153 changed files with 493 additions and 319 deletions

View File

@@ -1,3 +1,4 @@
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
export default Component.extend({
@@ -60,7 +61,7 @@ export default Component.extend({
this.updateField();
this.set("inviteEmail", "");
Ember.run.scheduleOnce("afterRender", () =>
scheduleOnce("afterRender", () =>
this.element.querySelector(".invite-email").focus()
);
},

View File

@@ -1,3 +1,4 @@
import { next } from "@ember/runloop";
import Component from "@ember/component";
import { observes, on } from "ember-addons/ember-computed-decorators";
@@ -13,7 +14,7 @@ export default Component.extend({
@on("init")
updateVal() {
const checked = this.value === this.radioValue;
Ember.run.next(
next(
() => (this.element.querySelector("input[type=radio]").checked = checked)
);
}

View File

@@ -1,3 +1,4 @@
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
import getUrl from "discourse-common/lib/get-url";
import {
@@ -92,7 +93,7 @@ export default Component.extend({
},
autoFocus() {
Ember.run.scheduleOnce("afterRender", () => {
scheduleOnce("afterRender", () => {
const $invalid = $(".wizard-field.invalid:eq(0) .wizard-focusable");
if ($invalid.length) {
@@ -104,7 +105,7 @@ export default Component.extend({
},
animateInvalidFields() {
Ember.run.scheduleOnce("afterRender", () =>
scheduleOnce("afterRender", () =>
$(".invalid input[type=text], .invalid textarea").wiggle(2, 100)
);
},

View File

@@ -1,3 +1,4 @@
import { run } from "@ember/runloop";
import getUrl from "discourse-common/lib/get-url";
import jQuery from "jquery";
@@ -14,8 +15,8 @@ export function getToken() {
export function ajax(args) {
return new Ember.RSVP.Promise((resolve, reject) => {
args.headers = { "X-CSRF-Token": getToken() };
args.success = data => Ember.run(null, resolve, data);
args.error = xhr => Ember.run(null, reject, xhr);
args.success = data => run(null, resolve, data);
args.error = xhr => run(null, reject, xhr);
args.url = getUrl(args.url);
jQuery.ajax(args);
});

View File

@@ -1,3 +1,4 @@
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
/*eslint no-bitwise:0 */
import getUrl from "discourse-common/lib/get-url";
@@ -72,7 +73,7 @@ export function createPreviewComponent(width, height, obj) {
},
triggerRepaint() {
Ember.run.scheduleOnce("afterRender", this, "repaint");
scheduleOnce("afterRender", this, "repaint");
},
repaint() {

View File

@@ -1,3 +1,4 @@
import { run } from "@ember/runloop";
import startApp from "wizard/test/helpers/start-app";
var wizard;
@@ -7,7 +8,7 @@ QUnit.module("Acceptance: wizard", {
},
afterEach() {
Ember.run(wizard, "destroy");
run(wizard, "destroy");
}
});

View File

@@ -1,3 +1,4 @@
import { run } from "@ember/runloop";
import Wizard from "wizard/wizard";
import initializer from "wizard/initializers/load-helpers";
@@ -5,7 +6,7 @@ let app;
let started = false;
export default function() {
Ember.run(() => (app = Wizard.create({ rootElement: "#ember-testing" })));
run(() => (app = Wizard.create({ rootElement: "#ember-testing" })));
if (!started) {
initializer.initialize(app);