REFACTOR: Use imports for `Ember.run`
This commit is contained in:
parent
c7475ee03b
commit
5ca60fcb6b
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
||||
|
@ -53,7 +54,7 @@ export default Component.extend(
|
|||
// force rerender
|
||||
this.rerenderBuffer();
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._scrollDown);
|
||||
scheduleOnce("afterRender", this, this._scrollDown);
|
||||
}, 150),
|
||||
|
||||
buildBuffer(buffer) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { number } from "discourse/lib/formatter";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
|
@ -11,7 +13,7 @@ export default Component.extend({
|
|||
this._super(...arguments);
|
||||
|
||||
this.resizeHandler = () =>
|
||||
Ember.run.debounce(this, this._scheduleChartRendering, 500);
|
||||
debounce(this, this._scheduleChartRendering, 500);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
@ -31,11 +33,11 @@ export default Component.extend({
|
|||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
Ember.run.debounce(this, this._scheduleChartRendering, 100);
|
||||
debounce(this, this._scheduleChartRendering, 100);
|
||||
},
|
||||
|
||||
_scheduleChartRendering() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this._renderChart(
|
||||
this.model,
|
||||
this.element && this.element.querySelector(".chart-canvas")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { number } from "discourse/lib/formatter";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
|
@ -9,7 +11,7 @@ export default Component.extend({
|
|||
this._super(...arguments);
|
||||
|
||||
this.resizeHandler = () =>
|
||||
Ember.run.debounce(this, this._scheduleChartRendering, 500);
|
||||
debounce(this, this._scheduleChartRendering, 500);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
@ -29,11 +31,11 @@ export default Component.extend({
|
|||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
Ember.run.debounce(this, this._scheduleChartRendering, 100);
|
||||
debounce(this, this._scheduleChartRendering, 100);
|
||||
},
|
||||
|
||||
_scheduleChartRendering() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
if (!this.element) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import ReportLoader from "discourse/lib/reports-loader";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
|
@ -313,7 +314,7 @@ export default Component.extend({
|
|||
|
||||
this.setProperties({ isLoading: true, rateLimitationString: null });
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
let payload = this._buildPayload(["prev_period"]);
|
||||
|
||||
const callback = response => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
@ -83,7 +84,7 @@ export default Component.extend({
|
|||
|
||||
toggleMaximize: function() {
|
||||
this.toggleProperty("maximized");
|
||||
Ember.run.next(() => this.appEvents.trigger("ace:resize"));
|
||||
next(() => this.appEvents.trigger("ace:resize"));
|
||||
},
|
||||
|
||||
onlyOverriddenChanged(value) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import UserField from "admin/models/user-field";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
|
@ -28,7 +29,7 @@ export default Component.extend(bufferedProperty("userField"), {
|
|||
@observes("editing")
|
||||
_focusOnEdit() {
|
||||
if (this.editing) {
|
||||
Ember.run.scheduleOnce("afterRender", this, "_focusName");
|
||||
scheduleOnce("afterRender", this, "_focusName");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as loadScript, loadCSS } from "discourse/lib/load-script";
|
||||
|
||||
|
@ -37,7 +38,7 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
loadScript("/javascripts/spectrum.js").then(() => {
|
||||
loadCSS("/javascripts/spectrum.css").then(() => {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".picker"))
|
||||
.spectrum({ color: "#" + this.hexValue })
|
||||
.on("change.spectrum", (me, color) => {
|
||||
|
@ -47,7 +48,7 @@ export default Component.extend({
|
|||
});
|
||||
});
|
||||
});
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.hexValueChanged();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
@ -14,7 +15,7 @@ export default Component.extend(bufferedProperty("host"), {
|
|||
@on("didInsertElement")
|
||||
@observes("editing")
|
||||
_focusOnInput() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.element.querySelector(".host-name").focus();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -78,7 +79,7 @@ export default Component.extend({
|
|||
$(document.body).append($copyRange);
|
||||
if (copyText(text, $copyRange[0])) {
|
||||
this.set("copied", true);
|
||||
Ember.run.later(() => this.set("copied", false), 2000);
|
||||
later(() => this.set("copied", false), 2000);
|
||||
}
|
||||
$copyRange.remove();
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -23,7 +24,7 @@ export default Component.extend({
|
|||
|
||||
// If we switch to edit mode, jump to the edit textarea
|
||||
if (postAction === "edit") {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
let elem = this.element;
|
||||
let body = elem.closest(".modal-body");
|
||||
body.scrollTop(body.height());
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
@ -20,7 +21,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
focusPermalink() {
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".permalink-url").focus()
|
||||
);
|
||||
},
|
||||
|
@ -69,7 +70,7 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".external-url")).keydown(e => {
|
||||
// enter key
|
||||
if (e.keyCode === 13) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
@ -45,18 +47,18 @@ export default Component.extend(
|
|||
this.resumable.upload();
|
||||
|
||||
// mark as uploading
|
||||
Ember.run.later(() => this.set("isUploading", true));
|
||||
later(() => this.set("isUploading", true));
|
||||
});
|
||||
|
||||
this.resumable.on("fileProgress", file => {
|
||||
// update progress
|
||||
Ember.run.later(() =>
|
||||
later(() =>
|
||||
this.set("progress", parseInt(file.progress() * 100, 10))
|
||||
);
|
||||
});
|
||||
|
||||
this.resumable.on("fileSuccess", file => {
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
// mark as not uploading anymore
|
||||
this._reset();
|
||||
|
||||
|
@ -66,7 +68,7 @@ export default Component.extend(
|
|||
});
|
||||
|
||||
this.resumable.on("fileError", (file, message) => {
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
// mark as not uploading anymore
|
||||
this._reset();
|
||||
|
||||
|
@ -78,7 +80,7 @@ export default Component.extend(
|
|||
|
||||
@on("didInsertElement")
|
||||
_assignBrowse() {
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
this.resumable.assignBrowse($(this.element))
|
||||
);
|
||||
},
|
||||
|
@ -117,7 +119,7 @@ export default Component.extend(
|
|||
click() {
|
||||
if (this.isUploading) {
|
||||
this.resumable.cancel();
|
||||
Ember.run.later(() => this._reset());
|
||||
later(() => this._reset());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/**
|
||||
A form to create an IP address that will be blocked or whitelisted.
|
||||
|
@ -62,7 +63,7 @@ export default Component.extend({
|
|||
.then(result => {
|
||||
this.setProperties({ ip_address: "", formSubmitted: false });
|
||||
this.action(ScreenedIpAddress.create(result.screened_ip_address));
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".ip-address-input").focus()
|
||||
);
|
||||
})
|
||||
|
@ -84,7 +85,7 @@ export default Component.extend({
|
|||
|
||||
@on("didInsertElement")
|
||||
_init() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".ip-address-input")).keydown(e => {
|
||||
if (e.keyCode === 13) {
|
||||
this.send("submit");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -33,7 +34,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
scheduleAnimation() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.animate(true);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import {
|
||||
|
@ -64,7 +65,7 @@ export default Component.extend({
|
|||
message: I18n.t("admin.watched_words.form.success")
|
||||
});
|
||||
this.action(WatchedWord.create(result));
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".watched-word-input").focus()
|
||||
);
|
||||
})
|
||||
|
@ -86,7 +87,7 @@ export default Component.extend({
|
|||
|
||||
@on("didInsertElement")
|
||||
_init() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".watched-word-input")).keydown(e => {
|
||||
if (e.keyCode === 13) {
|
||||
this.send("submit");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -41,7 +42,7 @@ export default Controller.extend({
|
|||
);
|
||||
}
|
||||
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
this.set("model.savingStatus", null);
|
||||
}, 2000);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
const { get } = Ember;
|
||||
|
@ -21,7 +22,7 @@ export default Controller.extend({
|
|||
|
||||
actions: {
|
||||
filterReports(filter) {
|
||||
Ember.run.debounce(this, this._performFiltering, filter, 250);
|
||||
debounce(this, this._performFiltering, filter, 250);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
|
@ -68,7 +69,7 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
scheduleRefresh() {
|
||||
Ember.run.scheduleOnce("afterRender", this, this._refresh);
|
||||
scheduleOnce("afterRender", this, this._refresh);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
let lastSearch;
|
||||
|
||||
|
@ -27,14 +28,14 @@ export default Controller.extend({
|
|||
toggleOverridden() {
|
||||
this.toggleProperty("overridden");
|
||||
this.set("searching", true);
|
||||
Ember.run.debounce(this, this._performSearch, 400);
|
||||
debounce(this, this._performSearch, 400);
|
||||
},
|
||||
|
||||
search() {
|
||||
const q = this.q;
|
||||
if (q !== lastSearch) {
|
||||
this.set("searching", true);
|
||||
Ember.run.debounce(this, this._performSearch, 400);
|
||||
debounce(this, this._performSearch, 400);
|
||||
lastSearch = q;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
|
||||
|
@ -71,7 +72,7 @@ export default Controller.extend(GrantBadgeController, {
|
|||
).then(
|
||||
() => {
|
||||
this.set("badgeReason", "");
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
// Update the selected badge ID after the combobox has re-rendered.
|
||||
const newSelectedBadge = this.grantableBadges[0];
|
||||
if (newSelectedBadge) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
@ -51,7 +52,7 @@ export default Controller.extend({
|
|||
if (a) {
|
||||
a.words.unshiftObject(arg);
|
||||
a.incrementProperty("count");
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
// remove from other actions lists
|
||||
let match = null;
|
||||
this.get("adminWatchedWords.model").forEach(action => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
// Ember 2.0 removes buffered rendering, but we can still implement it ourselves.
|
||||
// In the long term we'll want to remove this.
|
||||
|
||||
|
@ -13,7 +14,7 @@ const Mixin = {
|
|||
},
|
||||
|
||||
rerenderBuffer() {
|
||||
Ember.run.scheduleOnce("render", this, this._customRender);
|
||||
scheduleOnce("render", this, this._customRender);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { bind } from "@ember/runloop";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
ready() {
|
||||
this._super(...arguments);
|
||||
|
||||
this._onChangeHandler = Ember.run.bind(this, this._onChange);
|
||||
this._onChangeHandler = bind(this, this._onChange);
|
||||
|
||||
// Default to true
|
||||
Discourse.set("hasFocus", true);
|
||||
|
|
|
@ -14,6 +14,18 @@ var define, requirejs;
|
|||
"@ember/object": { default: Ember.Object },
|
||||
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
||||
"@ember/routing/route": { default: Ember.Route },
|
||||
"@ember/runloop": {
|
||||
bind: Ember.run.bind,
|
||||
cancel: Ember.run.cancel,
|
||||
debounce: Ember.run.debounce,
|
||||
later: Ember.run.later,
|
||||
next: Ember.run.next,
|
||||
once: Ember.run.once,
|
||||
run: Ember.run,
|
||||
schedule: Ember.run.schedule,
|
||||
scheduleOnce: Ember.run.scheduleOnce,
|
||||
throttle: Ember.run.throttle
|
||||
},
|
||||
"@ember/service": {
|
||||
default: Ember.Service,
|
||||
inject: Ember.inject.service
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -26,7 +27,7 @@ export default Component.extend({
|
|||
|
||||
@observes("category.fullSlug", "tags")
|
||||
refreshClass() {
|
||||
Ember.run.scheduleOnce("afterRender", this, this._updateClass);
|
||||
scheduleOnce("afterRender", this, this._updateClass);
|
||||
},
|
||||
|
||||
_removeClass() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
|
@ -57,7 +58,7 @@ export default Component.extend({
|
|||
chooseMessage(message) {
|
||||
const messageId = Ember.get(message, "id");
|
||||
this.set("selectedTopicId", messageId);
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
$(`#choose-message-${messageId}`).prop("checked", "true")
|
||||
);
|
||||
return false;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
|
@ -62,7 +63,7 @@ export default Component.extend({
|
|||
actions: {
|
||||
chooseTopic(topic) {
|
||||
this.set("selectedTopicId", topic.id);
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
document.getElementById(`choose-topic-${topic.id}`).checked = true;
|
||||
});
|
||||
return false;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import { throttle } from "@ember/runloop";
|
||||
import { run } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -60,7 +65,7 @@ export default Component.extend(KeyEnterEscape, {
|
|||
"composer.canEditTopicFeaturedLink"
|
||||
)
|
||||
resize() {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
@ -78,8 +83,8 @@ export default Component.extend(KeyEnterEscape, {
|
|||
|
||||
// One second from now, check to see if the last key was hit when
|
||||
// we recorded it. If it was, the user paused typing.
|
||||
Ember.run.cancel(this._lastKeyTimeout);
|
||||
this._lastKeyTimeout = Ember.run.later(() => {
|
||||
cancel(this._lastKeyTimeout);
|
||||
this._lastKeyTimeout = later(() => {
|
||||
if (lastKeyUp !== this._lastKeyUp) {
|
||||
return;
|
||||
}
|
||||
|
@ -116,7 +121,7 @@ export default Component.extend(KeyEnterEscape, {
|
|||
|
||||
const throttledPerformDrag = (event => {
|
||||
event.preventDefault();
|
||||
Ember.run.throttle(this, performDrag, event, THROTTLE_RATE);
|
||||
throttle(this, performDrag, event, THROTTLE_RATE);
|
||||
}).bind(this);
|
||||
|
||||
const endDrag = () => {
|
||||
|
@ -153,7 +158,7 @@ export default Component.extend(KeyEnterEscape, {
|
|||
this._super(...arguments);
|
||||
this.setupComposerResizeEvents();
|
||||
|
||||
const resize = () => Ember.run(() => this.resize());
|
||||
const resize = () => run(() => this.resize());
|
||||
const triggerOpen = () => {
|
||||
if (this.get("composer.composeState") === Composer.OPEN) {
|
||||
this.appEvents.trigger("composer:opened");
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import { throttle } from "@ember/runloop";
|
||||
import { next } from "@ember/runloop";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import userSearch from "discourse/lib/user-search";
|
||||
import {
|
||||
|
@ -183,7 +188,7 @@ export default Component.extend({
|
|||
transformComplete: v => v.username || v.name,
|
||||
afterComplete() {
|
||||
// ensures textarea scroll position is correct
|
||||
Ember.run.scheduleOnce("afterRender", () => $input.blur().focus());
|
||||
scheduleOnce("afterRender", () => $input.blur().focus());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -192,7 +197,7 @@ export default Component.extend({
|
|||
this._initInputPreviewSync($input, $preview);
|
||||
} else {
|
||||
$input.on("scroll", () =>
|
||||
Ember.run.throttle(
|
||||
throttle(
|
||||
this,
|
||||
this._syncEditorAndPreviewScroll,
|
||||
$input,
|
||||
|
@ -316,7 +321,7 @@ export default Component.extend({
|
|||
this.appEvents.on(event, this, this._resetShouldBuildScrollMap);
|
||||
});
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
$input.on("touchstart mouseenter", () => {
|
||||
if (!$preview.is(":visible")) return;
|
||||
$preview.off("scroll");
|
||||
|
@ -342,7 +347,7 @@ export default Component.extend({
|
|||
this.set("shouldBuildScrollMap", false);
|
||||
}
|
||||
|
||||
Ember.run.throttle(this, $callback, $input, $preview, this.scrollMap, 20);
|
||||
throttle(this, $callback, $input, $preview, this.scrollMap, 20);
|
||||
},
|
||||
|
||||
_teardownInputPreviewSync() {
|
||||
|
@ -559,7 +564,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
_warnMentionedGroups($preview) {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
var found = this.warnedGroupMentions || [];
|
||||
$preview.find(".mention-group.notify").each((idx, e) => {
|
||||
const $e = $(e);
|
||||
|
@ -587,7 +592,7 @@ export default Component.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
let found = this.warnedCannotSeeMentions || [];
|
||||
|
||||
$preview.find(".mention.cannot-see").each((idx, e) => {
|
||||
|
@ -597,7 +602,7 @@ export default Component.extend({
|
|||
if (found.indexOf(name) === -1) {
|
||||
// add a delay to allow for typing, so you don't open the warning right away
|
||||
// previously we would warn after @bob even if you were about to mention @bob2
|
||||
Ember.run.later(
|
||||
later(
|
||||
this,
|
||||
() => {
|
||||
if (
|
||||
|
@ -618,7 +623,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
_resetUpload(removePlaceholder) {
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
if (this._validUploads > 0) {
|
||||
this._validUploads--;
|
||||
}
|
||||
|
@ -897,9 +902,9 @@ export default Component.extend({
|
|||
@on("willDestroyElement")
|
||||
_composerClosed() {
|
||||
this.appEvents.trigger("composer:will-close");
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
// need to wait a bit for the "slide down" transition of the composer
|
||||
Ember.run.later(
|
||||
later(
|
||||
() => this.appEvents.trigger("composer:closed"),
|
||||
Ember.testing ? 0 : 400
|
||||
);
|
||||
|
@ -970,7 +975,7 @@ export default Component.extend({
|
|||
// Paint mentions
|
||||
const unseenMentions = linkSeenMentions($preview, this.siteSettings);
|
||||
if (unseenMentions.length) {
|
||||
Ember.run.debounce(
|
||||
debounce(
|
||||
this,
|
||||
this._renderUnseenMentions,
|
||||
$preview,
|
||||
|
@ -985,7 +990,7 @@ export default Component.extend({
|
|||
// Paint category hashtags
|
||||
const unseenCategoryHashtags = linkSeenCategoryHashtags($preview);
|
||||
if (unseenCategoryHashtags.length) {
|
||||
Ember.run.debounce(
|
||||
debounce(
|
||||
this,
|
||||
this._renderUnseenCategoryHashtags,
|
||||
$preview,
|
||||
|
@ -998,7 +1003,7 @@ export default Component.extend({
|
|||
if (this.siteSettings.tagging_enabled) {
|
||||
const unseenTagHashtags = linkSeenTagHashtags($preview);
|
||||
if (unseenTagHashtags.length) {
|
||||
Ember.run.debounce(
|
||||
debounce(
|
||||
this,
|
||||
this._renderUnseenTagHashtags,
|
||||
$preview,
|
||||
|
@ -1009,7 +1014,7 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
// Paint oneboxes
|
||||
Ember.run.debounce(
|
||||
debounce(
|
||||
this,
|
||||
() => {
|
||||
const oneboxes = {};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import LinkLookup from "discourse/lib/link-lookup";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default Component.extend({
|
|||
this.appEvents.on("composer:find-similar", this, this._findSimilar);
|
||||
this.appEvents.on("composer-messages:close", this, this._closeTop);
|
||||
this.appEvents.on("composer-messages:create", this, this._create);
|
||||
Ember.run.scheduleOnce("afterRender", this, this.reset);
|
||||
scheduleOnce("afterRender", this, this.reset);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -24,7 +27,7 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
if (this.get("composer.titleLength") > 0) {
|
||||
Ember.run.debounce(this, this._titleChanged, 10);
|
||||
debounce(this, this._titleChanged, 10);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -79,13 +82,13 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
if (Ember.testing) {
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
// not ideal but we don't want to run this in current
|
||||
// runloop to avoid an error in console
|
||||
this._checkForUrl()
|
||||
);
|
||||
} else {
|
||||
Ember.run.debounce(this, this._checkForUrl, 500);
|
||||
debounce(this, this._checkForUrl, 500);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -134,14 +137,14 @@ export default Component.extend({
|
|||
})
|
||||
.finally(() => {
|
||||
this.set("composer.loading", false);
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector("input")).putCursorAtEnd();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this._updatePost(loadOnebox);
|
||||
this.set("composer.loading", false);
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector("input")).putCursorAtEnd();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -76,7 +77,7 @@ export default Component.extend({
|
|||
toggleSelector() {
|
||||
this.set("showSelector", true);
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element)
|
||||
.find("input")
|
||||
.focus();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { cookAsync } from "discourse/lib/text";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -12,7 +13,7 @@ const CookText = Component.extend({
|
|||
this.set("cooked", cooked);
|
||||
// no choice but to defer this cause
|
||||
// pretty text may only be loaded now
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
window
|
||||
.requireModule("pretty-text/upload-short-url")
|
||||
.resolveAllShortUrls(ajax)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import { inject as service } from "@ember/service";
|
||||
import Component from "@ember/component";
|
||||
/*global Mousetrap:true */
|
||||
|
@ -249,7 +254,7 @@ export default Component.extend({
|
|||
this._applyEmojiAutocomplete($editorInput);
|
||||
this._applyCategoryHashtagAutocomplete($editorInput);
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._readyNow);
|
||||
scheduleOnce("afterRender", this, this._readyNow);
|
||||
|
||||
const mouseTrap = Mousetrap(this.element.querySelector(".d-editor-input"));
|
||||
const shortcuts = this.get("toolbar.shortcuts");
|
||||
|
@ -348,7 +353,7 @@ export default Component.extend({
|
|||
return;
|
||||
}
|
||||
this.set("preview", cooked);
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
if (this._state !== "inDOM") {
|
||||
return;
|
||||
}
|
||||
|
@ -372,7 +377,7 @@ export default Component.extend({
|
|||
if (Ember.testing) {
|
||||
this._updatePreview();
|
||||
} else {
|
||||
Ember.run.debounce(this, this._updatePreview, 30);
|
||||
debounce(this, this._updatePreview, 30);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -432,14 +437,14 @@ export default Component.extend({
|
|||
emojiPickerIsActive: true
|
||||
});
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
const filterInput = document.querySelector(
|
||||
".emoji-picker input[name='filter']"
|
||||
);
|
||||
if (filterInput) {
|
||||
filterInput.value = v.term;
|
||||
|
||||
Ember.run.later(
|
||||
later(
|
||||
() => filterInput.dispatchEvent(new Event("input")),
|
||||
50
|
||||
);
|
||||
|
@ -547,7 +552,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
_selectText(from, length) {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
const textarea = this.element.querySelector("textarea.d-editor-input");
|
||||
const $textarea = $(textarea);
|
||||
const oldScrollPos = $textarea.scrollTop();
|
||||
|
@ -556,7 +561,7 @@ export default Component.extend({
|
|||
}
|
||||
textarea.selectionStart = from;
|
||||
textarea.selectionEnd = from + length;
|
||||
Ember.run.next(() => $textarea.trigger("change"));
|
||||
next(() => $textarea.trigger("change"));
|
||||
$textarea.scrollTop(oldScrollPos);
|
||||
});
|
||||
},
|
||||
|
@ -785,7 +790,7 @@ export default Component.extend({
|
|||
$textarea.val(value);
|
||||
$textarea.prop("selectionStart", insert.length);
|
||||
$textarea.prop("selectionEnd", insert.length);
|
||||
Ember.run.next(() => $textarea.trigger("change"));
|
||||
next(() => $textarea.trigger("change"));
|
||||
this._focusTextArea();
|
||||
},
|
||||
|
||||
|
@ -886,7 +891,7 @@ export default Component.extend({
|
|||
// ensures textarea scroll position is correct
|
||||
_focusTextArea() {
|
||||
const textarea = this.element.querySelector("textarea.d-editor-input");
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
textarea.blur();
|
||||
textarea.focus();
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
classNames: ["modal-body"],
|
||||
|
@ -14,7 +15,7 @@ export default Component.extend({
|
|||
fixedParent.modal("show");
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._afterFirstRender);
|
||||
scheduleOnce("afterRender", this, this._afterFirstRender);
|
||||
this.appEvents.on("modal-body:flash", this, "_flash");
|
||||
this.appEvents.on("modal-body:clearFlash", this, "_clearFlash");
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import Component from "@ember/component";
|
||||
|
||||
|
@ -32,11 +33,11 @@ export default Component.extend({
|
|||
setUp() {
|
||||
$("html").on("keydown.discourse-modal", e => {
|
||||
if (e.which === 27 && this.dismissable) {
|
||||
Ember.run.next(() => $(".modal-header button.modal-close").click());
|
||||
next(() => $(".modal-header button.modal-close").click());
|
||||
}
|
||||
|
||||
if (e.which === 13 && this.triggerClickOnEnter(e)) {
|
||||
Ember.run.next(() => $(".modal-footer .btn-primary").click());
|
||||
next(() => $(".modal-footer .btn-primary").click());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/* global Pikaday:true */
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
|
@ -37,7 +38,7 @@ export default Component.extend({
|
|||
|
||||
_loadPikadayPicker(container) {
|
||||
loadScript("/javascripts/pikaday.js").then(() => {
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
const default_opts = {
|
||||
field: this.element.querySelector(".date-picker"),
|
||||
container: container || this.element,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/* global Pikaday:true */
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
|
@ -30,7 +31,7 @@ export default Component.extend({
|
|||
|
||||
_loadPikadayPicker(container) {
|
||||
loadScript("/javascripts/pikaday.js").then(() => {
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
const options = {
|
||||
field: this.element.querySelector(".date-picker"),
|
||||
container: container || null,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import { throttle } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import AddArchetypeClass from "discourse/mixins/add-archetype-class";
|
||||
|
@ -50,13 +54,13 @@ export default Component.extend(
|
|||
const enteredAt = this.enteredAt;
|
||||
if (enteredAt && this.lastEnteredAt !== enteredAt) {
|
||||
this._lastShowTopic = null;
|
||||
Ember.run.schedule("afterRender", () => this.scrolled());
|
||||
schedule("afterRender", () => this.scrolled());
|
||||
this.set("lastEnteredAt", enteredAt);
|
||||
}
|
||||
},
|
||||
|
||||
_highlightPost(postNumber) {
|
||||
Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
|
||||
scheduleOnce("afterRender", null, highlight, postNumber);
|
||||
},
|
||||
|
||||
_hideTopicInHeader() {
|
||||
|
@ -78,7 +82,7 @@ export default Component.extend(
|
|||
this.pauseHeaderTopicUpdate = true;
|
||||
this._lastShowTopic = true;
|
||||
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
this._lastShowTopic = false;
|
||||
this.pauseHeaderTopicUpdate = false;
|
||||
}, debounceDuration);
|
||||
|
@ -192,7 +196,7 @@ export default Component.extend(
|
|||
// at the start of the scroll. This feels a lot more snappy compared to waiting
|
||||
// for the scroll to end if we debounce.
|
||||
if (this.site.mobileView && this.hasScrolled) {
|
||||
Ember.run.throttle(
|
||||
throttle(
|
||||
this,
|
||||
this.calculateDirection,
|
||||
offset,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
@ -12,11 +14,11 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
|
|||
_readjustScrollPosition() {
|
||||
const scrollTo = this.session.get("topicListScrollPosition");
|
||||
if (scrollTo && scrollTo >= 0) {
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
$(window).scrollTop(scrollTo + 1)
|
||||
);
|
||||
} else {
|
||||
Ember.run.scheduleOnce("afterRender", this, this.loadMoreUnlessFull);
|
||||
scheduleOnce("afterRender", this, this.loadMoreUnlessFull);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -38,7 +40,7 @@ const DiscoveryTopicsListComponent = Component.extend(UrlRefresh, LoadMore, {
|
|||
loadMore() {
|
||||
Discourse.updateContextCount(0);
|
||||
this.model.loadMore().then(hasMoreResults => {
|
||||
Ember.run.schedule("afterRender", () => this.saveScrollPosition());
|
||||
schedule("afterRender", () => this.saveScrollPosition());
|
||||
if (!hasMoreResults) {
|
||||
this.eyeline.flushRest();
|
||||
} else if ($(window).height() >= $(document).height()) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { propertyEqual } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
@ -20,7 +21,7 @@ export default Component.extend({
|
|||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
Ember.run.scheduleOnce("afterRender", this, this._addToCollection);
|
||||
scheduleOnce("afterRender", this, this._addToCollection);
|
||||
},
|
||||
|
||||
_addToCollection: function() {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
||||
|
||||
export default buildCategoryPanel("topic-template", {
|
||||
_activeTabChanged: function() {
|
||||
if (this.activeTab) {
|
||||
Ember.run.scheduleOnce("afterRender", () =>
|
||||
scheduleOnce("afterRender", () =>
|
||||
this.element.querySelector(".d-editor-input").focus()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -73,7 +74,7 @@ export default Component.extend({
|
|||
@observes("selection")
|
||||
_updateBasedOnLastPost() {
|
||||
if (!this.autoClose) {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.set("topicTimer.based_on_last_post", false);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import autosize from "discourse/lib/autosize";
|
||||
|
||||
export default Ember.TextArea.extend({
|
||||
@on("didInsertElement")
|
||||
_startWatching() {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
$(this.element).focus();
|
||||
autosize(this.element);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -16,6 +17,6 @@ export default Component.extend({
|
|||
|
||||
@observes("nameKey")
|
||||
selectedChanged() {
|
||||
Ember.run.next(this, this._selectRadio);
|
||||
next(this, this._selectRadio);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { throttle } from "@ember/runloop";
|
||||
import MountWidget from "discourse/components/mount-widget";
|
||||
import MobileScrollDirection from "discourse/mixins/mobile-scroll-direction";
|
||||
import Scrolling from "discourse/mixins/scrolling";
|
||||
|
@ -78,7 +79,7 @@ const FooterNavComponent = MountWidget.extend(
|
|||
|
||||
const offset = window.pageYOffset || $("html").scrollTop();
|
||||
|
||||
Ember.run.throttle(
|
||||
throttle(
|
||||
this,
|
||||
this.calculateDirection,
|
||||
offset,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { bind } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
|
@ -88,10 +89,10 @@ export default Component.extend(
|
|||
|
||||
@on("didInsertElement")
|
||||
_setupLogsNotice() {
|
||||
this._boundRerenderBuffer = Ember.run.bind(this, this.rerenderBuffer);
|
||||
this._boundRerenderBuffer = bind(this, this.rerenderBuffer);
|
||||
LogsNotice.current().addObserver("hidden", this._boundRerenderBuffer);
|
||||
|
||||
this._boundResetCurrentProp = Ember.run.bind(
|
||||
this._boundResetCurrentProp = bind(
|
||||
this,
|
||||
this._resetCurrentProp
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
@ -25,7 +26,7 @@ export default Component.extend({
|
|||
|
||||
@observes("model.flair_url")
|
||||
_loadSVGIcon() {
|
||||
Ember.run.debounce(this, this._loadIcon, 1000);
|
||||
debounce(this, this._loadIcon, 1000);
|
||||
},
|
||||
|
||||
_loadIcon() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
|
@ -77,13 +78,13 @@ export default Component.extend(UploadMixin, {
|
|||
},
|
||||
|
||||
_openLightbox() {
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
$(this.element.querySelector("a.lightbox")).magnificPopup("open")
|
||||
);
|
||||
},
|
||||
|
||||
_applyLightbox() {
|
||||
if (this.imageUrl) Ember.run.next(() => lightbox($(this.element)));
|
||||
if (this.imageUrl) next(() => lightbox($(this.element)));
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
showInput: false,
|
||||
|
@ -5,7 +6,7 @@ export default Component.extend({
|
|||
click() {
|
||||
this.onClick();
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element)
|
||||
.find("input")
|
||||
.focus();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
didInsertElement() {
|
||||
|
@ -14,7 +15,7 @@ export default Component.extend({
|
|||
this.set("loginName", $.cookie("email"));
|
||||
}
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$(
|
||||
"#login-account-password, #login-account-name, #login-second-factor"
|
||||
).keydown(e => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
|
@ -21,7 +22,7 @@ export default Component.extend({
|
|||
@observes("currentPath")
|
||||
currentPathChanged() {
|
||||
this.set("expanded", false);
|
||||
Ember.run.next(() => this._updateSelectedHtml());
|
||||
next(() => this._updateSelectedHtml());
|
||||
},
|
||||
|
||||
_updateSelectedHtml() {
|
||||
|
@ -41,7 +42,7 @@ export default Component.extend({
|
|||
toggleExpanded() {
|
||||
this.toggleProperty("expanded");
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
if (this.expanded) {
|
||||
$(window)
|
||||
.off("click.mobile-nav")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { cancel } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { diff, patch } from "virtual-dom";
|
||||
import { WidgetClickHook } from "discourse/widgets/hooks";
|
||||
|
@ -50,7 +52,7 @@ export default Component.extend({
|
|||
|
||||
this._rootNode = document.createElement("div");
|
||||
this.element.appendChild(this._rootNode);
|
||||
this._timeout = Ember.run.scheduleOnce("render", this, this.rerenderWidget);
|
||||
this._timeout = scheduleOnce("render", this, this.rerenderWidget);
|
||||
},
|
||||
|
||||
willClearRender() {
|
||||
|
@ -68,7 +70,7 @@ export default Component.extend({
|
|||
const [eventName, caller] = evt;
|
||||
this.appEvents.off(eventName, this, caller);
|
||||
});
|
||||
Ember.run.cancel(this._timeout);
|
||||
cancel(this._timeout);
|
||||
},
|
||||
|
||||
afterRender() {},
|
||||
|
@ -97,13 +99,13 @@ export default Component.extend({
|
|||
this._renderCallback = callback;
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce("render", this, this.rerenderWidget);
|
||||
scheduleOnce("render", this, this.rerenderWidget);
|
||||
},
|
||||
|
||||
buildArgs() {},
|
||||
|
||||
rerenderWidget() {
|
||||
Ember.run.cancel(this._timeout);
|
||||
cancel(this._timeout);
|
||||
|
||||
if (this._rootNode) {
|
||||
if (!this._widgetClass) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -69,7 +70,7 @@ export default Component.extend({
|
|||
if (this.expanded) {
|
||||
DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
if (!this.expanded) {
|
||||
return;
|
||||
}
|
||||
|
@ -77,7 +78,7 @@ export default Component.extend({
|
|||
$(this.element.querySelector(".drop a")).on("click", () => {
|
||||
this.element.querySelector(".drop").style.display = "none";
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { bind } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -18,7 +19,7 @@ export default Component.extend({
|
|||
|
||||
@on("didInsertElement")
|
||||
_registerListener() {
|
||||
this._promptEventHandler = Ember.run.bind(
|
||||
this._promptEventHandler = bind(
|
||||
this,
|
||||
this._handleInstallPromptEvent
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import { selectedText } from "discourse/lib/utilities";
|
||||
|
@ -103,7 +104,7 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
// change the position of the button
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
let top = markerOffset.top;
|
||||
let left = markerOffset.left + Math.max(0, parentScrollLeft);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import Scrolling from "discourse/mixins/scrolling";
|
||||
|
||||
|
@ -19,7 +20,7 @@ export default Component.extend(Scrolling, {
|
|||
|
||||
const data = this.session.get(this.trackerName);
|
||||
if (data && data.position >= 0 && data.tag === this.tag) {
|
||||
Ember.run.next(() => $(window).scrollTop(data.position + 1));
|
||||
next(() => $(window).scrollTop(data.position + 1));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import MountWidget from "discourse/components/mount-widget";
|
||||
import { cloak, uncloak } from "discourse/widgets/post-stream";
|
||||
|
@ -204,7 +207,7 @@ export default MountWidget.extend({
|
|||
// will cause the browser to scroll to the top of the document
|
||||
// in Chrome. This makes sure the scroll works correctly if that
|
||||
// happens.
|
||||
Ember.run.next(() => $("html, body").scrollTop(whereY));
|
||||
next(() => $("html, body").scrollTop(whereY));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -270,7 +273,7 @@ export default MountWidget.extend({
|
|||
},
|
||||
|
||||
_scrollTriggered() {
|
||||
Ember.run.scheduleOnce("afterRender", this, this.scrolled);
|
||||
scheduleOnce("afterRender", this, this.scrolled);
|
||||
},
|
||||
|
||||
_posted(staged) {
|
||||
|
@ -306,13 +309,13 @@ export default MountWidget.extend({
|
|||
},
|
||||
|
||||
_debouncedScroll() {
|
||||
Ember.run.debounce(this, this._scrollTriggered, 10);
|
||||
debounce(this, this._scrollTriggered, 10);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
const debouncedScroll = () =>
|
||||
Ember.run.debounce(this, this._scrollTriggered, 10);
|
||||
debounce(this, this._scrollTriggered, 10);
|
||||
|
||||
this._previouslyNearby = {};
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
@ -72,13 +74,13 @@ export default Component.extend({
|
|||
|
||||
this._init();
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", () => this._update());
|
||||
scheduleOnce("afterRender", () => this._update());
|
||||
},
|
||||
|
||||
@observes("searchTerm")
|
||||
_updateOptions() {
|
||||
this._update();
|
||||
Ember.run.debounce(this, this._update, 250);
|
||||
debounce(this, this._update, 250);
|
||||
},
|
||||
|
||||
_init() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
|
@ -47,7 +48,7 @@ export default Component.extend({
|
|||
this.element.querySelector(".topic-share-url-for-touch a")
|
||||
);
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
if (!this.capabilities.touch) {
|
||||
$linkForTouch.parent().remove();
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { bind } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
import { longDateNoYear } from "discourse/lib/formatter";
|
||||
|
@ -89,7 +91,7 @@ export default Component.extend({
|
|||
this.set("link", url);
|
||||
this.set("visible", true);
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._focusUrl);
|
||||
scheduleOnce("afterRender", this, this._focusUrl);
|
||||
},
|
||||
|
||||
_mouseDownHandler(event) {
|
||||
|
@ -154,9 +156,9 @@ export default Component.extend({
|
|||
|
||||
@on("init")
|
||||
_setupHandlers() {
|
||||
this._boundMouseDownHandler = Ember.run.bind(this, this._mouseDownHandler);
|
||||
this._boundClickHandler = Ember.run.bind(this, this._clickHandler);
|
||||
this._boundKeydownHandler = Ember.run.bind(this, this._keydownHandler);
|
||||
this._boundMouseDownHandler = bind(this, this._mouseDownHandler);
|
||||
this._boundClickHandler = bind(this, this._clickHandler);
|
||||
this._boundKeydownHandler = bind(this, this._keydownHandler);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
action: "showCreateAccount",
|
||||
|
@ -10,7 +11,7 @@ export default Component.extend({
|
|||
hideForSession() {
|
||||
this.session.set("hideSignupCta", true);
|
||||
this.keyValueStore.setItem("anon-cta-hidden", new Date().getTime());
|
||||
Ember.run.later(
|
||||
later(
|
||||
() => this.session.set("showSignupCta", false),
|
||||
20 * 1000
|
||||
);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { cancel } from "@ember/runloop";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import MountWidget from "discourse/components/mount-widget";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import Docking from "discourse/mixins/docking";
|
||||
|
@ -38,7 +41,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||
_animateClosing($panel, menuOrigin, windowWidth) {
|
||||
$panel.css(menuOrigin, -windowWidth);
|
||||
this._animate = true;
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.eventDispatched("dom:clean", "header");
|
||||
this._panMenuOffset = 0;
|
||||
});
|
||||
|
@ -222,7 +225,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||
this.appEvents.off("header:hide-topic", this, "setTopic");
|
||||
this.appEvents.off("dom:clean", this, "_cleanDom");
|
||||
|
||||
Ember.run.cancel(this._scheduledRemoveAnimate);
|
||||
cancel(this._scheduledRemoveAnimate);
|
||||
window.cancelAnimationFrame(this._scheduledMovingAnimation);
|
||||
},
|
||||
|
||||
|
@ -346,7 +349,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||
if (this._animate) {
|
||||
$panel.addClass("animate");
|
||||
$headerCloak.addClass("animate");
|
||||
this._scheduledRemoveAnimate = Ember.run.later(() => {
|
||||
this._scheduledRemoveAnimate = later(() => {
|
||||
$panel.removeClass("animate");
|
||||
$headerCloak.removeClass("animate");
|
||||
}, 200);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
Ember.run.next(null, () => {
|
||||
next(null, () => {
|
||||
const $this = $(this.element);
|
||||
|
||||
if ($this) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { isNumeric } from "discourse/lib/utilities";
|
||||
|
||||
|
@ -36,7 +37,7 @@ export default Component.extend({
|
|||
this._processMinutesChange(value);
|
||||
}
|
||||
|
||||
Ember.run.schedule("afterRender", () => (event.target.value = value));
|
||||
schedule("afterRender", () => (event.target.value = value));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import CleansUp from "discourse/mixins/cleans-up";
|
||||
|
@ -77,7 +78,7 @@ export default Component.extend(CleansUp, {
|
|||
|
||||
this.setProperties({ topic: data.topic, visible: true });
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._setCSS);
|
||||
scheduleOnce("afterRender", this, this._setCSS);
|
||||
|
||||
$("html")
|
||||
.off("mousedown.topic-entrance")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -69,7 +70,7 @@ export default Component.extend(LoadMore, {
|
|||
|
||||
let scrollTo = this.session.get("topicListScrollPosition");
|
||||
if (scrollTo && scrollTo >= 0) {
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
$(window).scrollTop(scrollTo + 1)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
@ -52,7 +54,7 @@ export default Component.extend(PanEvents, {
|
|||
},
|
||||
|
||||
_checkSize() {
|
||||
Ember.run.scheduleOnce("afterRender", this, this._performCheckSize);
|
||||
scheduleOnce("afterRender", this, this._performCheckSize);
|
||||
},
|
||||
|
||||
// we need to store this so topic progress has something to init with
|
||||
|
@ -88,7 +90,7 @@ export default Component.extend(PanEvents, {
|
|||
composerOpened() {
|
||||
this.set("composerOpen", true);
|
||||
// we need to do the check after animation is done
|
||||
Ember.run.later(() => this._checkSize(), 500);
|
||||
later(() => this._checkSize(), 500);
|
||||
},
|
||||
|
||||
composerClosed() {
|
||||
|
@ -99,7 +101,7 @@ export default Component.extend(PanEvents, {
|
|||
_collapseFullscreen() {
|
||||
if (this.get("info.topicProgressExpanded")) {
|
||||
$(".timeline-fullscreen").removeClass("show");
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
@ -137,7 +139,7 @@ export default Component.extend(PanEvents, {
|
|||
} else if (offset <= 0) {
|
||||
$timelineContainer.css("bottom", "");
|
||||
} else {
|
||||
Ember.run.later(() => this._handlePanDone(offset, event), 20);
|
||||
later(() => this._handlePanDone(offset, event), 20);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
|
@ -73,7 +74,7 @@ export default Component.extend({
|
|||
|
||||
@observes("postStream.stream.[]")
|
||||
_updateBar() {
|
||||
Ember.run.scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||
scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||
},
|
||||
|
||||
_topicScrolled(event) {
|
||||
|
@ -100,16 +101,16 @@ export default Component.extend({
|
|||
|
||||
const prevEvent = this.prevEvent;
|
||||
if (prevEvent) {
|
||||
Ember.run.scheduleOnce(
|
||||
scheduleOnce(
|
||||
"afterRender",
|
||||
this,
|
||||
this._topicScrolled,
|
||||
prevEvent
|
||||
);
|
||||
} else {
|
||||
Ember.run.scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||
scheduleOnce("afterRender", this, this._updateProgressBar);
|
||||
}
|
||||
Ember.run.scheduleOnce("afterRender", this, this._dock);
|
||||
scheduleOnce("afterRender", this, this._dock);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import MountWidget from "discourse/components/mount-widget";
|
||||
import Docking from "discourse/mixins/docking";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
@ -94,7 +95,7 @@ export default MountWidget.extend(Docking, {
|
|||
this._super(...arguments);
|
||||
|
||||
if (this.fullscreen && !this.addShowClass) {
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
this.set("addShowClass", true);
|
||||
this.queueRerender();
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { cancel } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
@ -85,7 +87,7 @@ export default Component.extend(
|
|||
|
||||
// TODO Sam: concerned this can cause a heavy rerender loop
|
||||
if (!Ember.testing) {
|
||||
this._delayedRerender = Ember.run.later(
|
||||
this._delayedRerender = later(
|
||||
this,
|
||||
this.rerender,
|
||||
rerenderDelay
|
||||
|
@ -110,7 +112,7 @@ export default Component.extend(
|
|||
$(this.element).off("click.topic-timer-remove", this.removeTopicTimer);
|
||||
|
||||
if (this._delayedRerender) {
|
||||
Ember.run.cancel(this._delayedRerender);
|
||||
cancel(this._delayedRerender);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
import ClickTrack from "discourse/lib/click-track";
|
||||
|
@ -23,7 +24,7 @@ export default Component.extend(LoadMore, {
|
|||
classNames: ["user-stream"],
|
||||
|
||||
_scrollTopOnModelChange: function() {
|
||||
Ember.run.schedule("afterRender", () => $(document).scrollTop(0));
|
||||
schedule("afterRender", () => $(document).scrollTop(0));
|
||||
}.observes("stream.user.id"),
|
||||
|
||||
_inserted: Ember.on("didInsertElement", function() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -24,7 +25,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
highlightSecure() {
|
||||
this.send("closeModal");
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
const $prefPasswordDiv = $(".pref-password");
|
||||
|
||||
$prefPasswordDiv.addClass("highlighted");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
@ -53,7 +54,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
if (this.get("topicController.multiSelect")) {
|
||||
this.topicController.send("toggleMultiSelect");
|
||||
}
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
DiscourseURL.routeTo(this.get("topicController.model.url"))
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
@ -47,7 +48,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
.then(() => {
|
||||
this.send("closeModal");
|
||||
this.setProperties({ date: "", time: "", saving: false });
|
||||
Ember.run.next(() => DiscourseURL.routeTo(topic.url));
|
||||
next(() => DiscourseURL.routeTo(topic.url));
|
||||
})
|
||||
.catch(() =>
|
||||
this.flash(I18n.t("topic.change_timestamp.error"), "alert-error")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
|
@ -1046,7 +1047,7 @@ export default Controller.extend({
|
|||
|
||||
@observes("model.reply", "model.title")
|
||||
_shouldSaveDraft() {
|
||||
Ember.run.debounce(this, this._saveDraft, 2000);
|
||||
debounce(this, this._saveDraft, 2000);
|
||||
},
|
||||
|
||||
@computed("model.categoryId", "lastValidatedAt")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import {
|
||||
on,
|
||||
|
@ -113,7 +114,7 @@ export default Controller.extend({
|
|||
tryLoading() {
|
||||
this.set("loading", true);
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this.lastTransition.retry();
|
||||
this.set("loading", false);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
|
@ -15,7 +18,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
selectedRow: -1
|
||||
});
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
const element = document.querySelector(".insert-link");
|
||||
|
||||
element.addEventListener("keydown", e => this.keyDown(e));
|
||||
|
@ -135,7 +138,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
.closest(".modal-inner-container")
|
||||
.removeEventListener("mousedown", this.mouseDown);
|
||||
|
||||
Ember.run.cancel(this._debounced);
|
||||
cancel(this._debounced);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
@ -174,7 +177,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
},
|
||||
search() {
|
||||
this._debounced = Ember.run.debounce(this, this.triggerSearch, 400);
|
||||
this._debounced = debounce(this, this.triggerSearch, 400);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
|
@ -10,7 +11,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
),
|
||||
|
||||
onShow() {
|
||||
Ember.run.next(() => $("#post-jump").focus());
|
||||
next(() => $("#post-jump").focus());
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { next } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
@ -150,7 +152,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
|
||||
// only need to focus the 2FA input for TOTP
|
||||
if (!this.showSecurityKey) {
|
||||
Ember.run.scheduleOnce("afterRender", () =>
|
||||
scheduleOnce("afterRender", () =>
|
||||
document
|
||||
.getElementById("second-factor")
|
||||
.querySelector("input")
|
||||
|
@ -322,7 +324,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
const loginError = (errorMsg, className, callback) => {
|
||||
showModal("login");
|
||||
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
if (callback) callback();
|
||||
this.flash(errorMsg, className || "success");
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
@ -92,7 +93,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
);
|
||||
} else if (!this.canSplitTopic) {
|
||||
this.set("selection", "existing_topic");
|
||||
Ember.run.next(() => $("#choose-topic-title").focus());
|
||||
next(() => $("#choose-topic-title").focus());
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
||||
|
@ -102,7 +103,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
_hideCopyMessage() {
|
||||
Ember.run.later(
|
||||
later(
|
||||
() => this.setProperties({ successMessage: null, errorMessage: null }),
|
||||
2000
|
||||
);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import { next } from "@ember/runloop";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
|
@ -133,7 +135,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
return;
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
scheduleOnce("afterRender", () => {
|
||||
this.send("showHistory", post, revision);
|
||||
});
|
||||
},
|
||||
|
@ -1426,7 +1428,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
// automatically unpin topics when the user reaches the bottom
|
||||
const max = _.max(postNumbers);
|
||||
if (topic.get("pinned") && max >= topic.get("highest_post_number")) {
|
||||
Ember.run.next(() => topic.clearPin());
|
||||
next(() => topic.clearPin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
// Subscribe to "asset-version" change events via the Message Bus
|
||||
export default {
|
||||
name: "asset-version",
|
||||
|
@ -16,7 +17,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.
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
bootbox.confirm(I18n.t("assets_changed_confirm"), function(result) {
|
||||
if (result) {
|
||||
document.location.reload();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
export default {
|
||||
name: "auth-complete",
|
||||
after: "inject-objects",
|
||||
|
@ -13,7 +14,7 @@ export default {
|
|||
if (lastAuthResult) {
|
||||
const router = container.lookup("router:main");
|
||||
router.one("didTransition", () => {
|
||||
Ember.run.next(() =>
|
||||
next(() =>
|
||||
Discourse.authenticationComplete(JSON.parse(lastAuthResult))
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import Mobile from "discourse/lib/mobile";
|
||||
import { setResolverOption } from "discourse-common/resolver";
|
||||
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
|
||||
|
@ -17,7 +18,7 @@ export default {
|
|||
setResolverOption("mobileView", Mobile.mobileView);
|
||||
|
||||
if (isAppWebview()) {
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
postRNWebviewMessage(
|
||||
"headerBg",
|
||||
$(".d-header").css("background-color")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { run } from "@ember/runloop";
|
||||
import pageVisible from "discourse/lib/page-visible";
|
||||
import logout from "discourse/lib/logout";
|
||||
|
||||
|
@ -96,7 +97,7 @@ export function ajax() {
|
|||
handleRedirect(data);
|
||||
handleLogoff(xhr);
|
||||
|
||||
Ember.run(() => {
|
||||
run(() => {
|
||||
Discourse.Site.currentProp(
|
||||
"isReadOnly",
|
||||
!!xhr.getResponseHeader("Discourse-Readonly")
|
||||
|
@ -107,7 +108,7 @@ export function ajax() {
|
|||
data = { result: data, xhr: xhr };
|
||||
}
|
||||
|
||||
Ember.run(null, resolve, data);
|
||||
run(null, resolve, data);
|
||||
};
|
||||
|
||||
args.error = (xhr, textStatus, errorThrown) => {
|
||||
|
@ -128,7 +129,7 @@ export function ajax() {
|
|||
xhr.jqTextStatus = textStatus;
|
||||
xhr.requestedUrl = url;
|
||||
|
||||
Ember.run(null, reject, {
|
||||
run(null, reject, {
|
||||
jqXHR: xhr,
|
||||
textStatus: textStatus,
|
||||
errorThrown: errorThrown
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { cancel } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
/**
|
||||
This is a jQuery plugin to support autocompleting values in our text fields.
|
||||
|
||||
|
@ -43,7 +45,7 @@ export default function(options) {
|
|||
if (this.length === 0) return;
|
||||
|
||||
if (options === "destroy" || options.updateData) {
|
||||
Ember.run.cancel(inputTimeout);
|
||||
cancel(inputTimeout);
|
||||
|
||||
$(this)
|
||||
.off("keyup.autocomplete")
|
||||
|
@ -402,7 +404,7 @@ export default function(options) {
|
|||
$(this).on("click.autocomplete", () => closeAutocomplete());
|
||||
|
||||
$(this).on("paste.autocomplete", () => {
|
||||
Ember.run.later(() => me.trigger("keydown"), 50);
|
||||
later(() => me.trigger("keydown"), 50);
|
||||
});
|
||||
|
||||
function checkTriggerRule(opts) {
|
||||
|
@ -455,8 +457,8 @@ export default function(options) {
|
|||
if (options.allowAny) {
|
||||
// saves us wiring up a change event as well
|
||||
|
||||
Ember.run.cancel(inputTimeout);
|
||||
inputTimeout = Ember.run.later(function() {
|
||||
cancel(inputTimeout);
|
||||
inputTimeout = later(function() {
|
||||
if (inputSelectedItems.length === 0) {
|
||||
inputSelectedItems.push("");
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
function _clean() {
|
||||
if (window.MiniProfiler) {
|
||||
window.MiniProfiler.pageTransition();
|
||||
|
@ -35,5 +36,5 @@ function _clean() {
|
|||
}
|
||||
|
||||
export function cleanDOM() {
|
||||
Ember.run.scheduleOnce("afterRender", _clean);
|
||||
scheduleOnce("afterRender", _clean);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
|
@ -134,7 +135,7 @@ export default {
|
|||
$link.attr("href", null);
|
||||
$link.data("auto-route", true);
|
||||
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
$link.removeClass("no-href");
|
||||
$link.attr("href", $link.data("href"));
|
||||
$link.data("href", null);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { debounce } from "@ember/runloop";
|
||||
/**
|
||||
Debounce a Javascript function. This means if it's called many times in a time limit it
|
||||
should only be executed once (at the end of the limit counted from the last call made).
|
||||
|
@ -13,6 +14,6 @@ export default function(func, wait) {
|
|||
self = this;
|
||||
args = arguments;
|
||||
|
||||
Ember.run.debounce(null, later, wait);
|
||||
debounce(null, later, wait);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import KeyValueStore from "discourse/lib/key-value-store";
|
||||
import { formatUsername } from "discourse/lib/utilities";
|
||||
|
@ -79,7 +80,7 @@ function confirmNotification() {
|
|||
const clickEventHandler = () => notification.close();
|
||||
|
||||
notification.addEventListener("click", clickEventHandler);
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
notification.close();
|
||||
notification.removeEventListener("click", clickEventHandler);
|
||||
}, 10 * 1000);
|
||||
|
@ -177,7 +178,7 @@ function onNotification(data) {
|
|||
}
|
||||
|
||||
notification.addEventListener("click", clickEventHandler);
|
||||
Ember.run.later(() => {
|
||||
later(() => {
|
||||
notification.close();
|
||||
notification.removeEventListener("click", clickEventHandler);
|
||||
}, 10 * 1000);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { run } from "@ember/runloop";
|
||||
import { later } from "@ember/runloop";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import Composer from "discourse/models/composer";
|
||||
import { minimumOffset } from "discourse/lib/offset-calculator";
|
||||
|
@ -140,7 +142,7 @@ export default {
|
|||
quoteReply() {
|
||||
this.sendToSelectedPost("replyToPost");
|
||||
// lazy but should work for now
|
||||
Ember.run.later(() => $(".d-editor .quote").click(), 500);
|
||||
later(() => $(".d-editor .quote").click(), 500);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
@ -210,7 +212,7 @@ export default {
|
|||
},
|
||||
|
||||
showPageSearch(event) {
|
||||
Ember.run(() => {
|
||||
run(() => {
|
||||
this.appEvents.trigger("header:keyboard-trigger", {
|
||||
type: "page-search",
|
||||
event
|
||||
|
@ -219,7 +221,7 @@ export default {
|
|||
},
|
||||
|
||||
printTopic(event) {
|
||||
Ember.run(() => {
|
||||
run(() => {
|
||||
if ($(".container.posts").length) {
|
||||
event.preventDefault(); // We need to stop printing the current page in Firefox
|
||||
this.container.lookup("controller:topic").print();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { replaceSpan } from "discourse/lib/category-hashtags";
|
||||
|
||||
|
@ -7,7 +8,7 @@ const testedKey = "tested";
|
|||
const testedClass = `hashtag-${testedKey}`;
|
||||
|
||||
function updateFound($hashtags, categorySlugs) {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$hashtags.each((index, hashtag) => {
|
||||
const categorySlug = categorySlugs[index];
|
||||
const link = validCategoryHashtags[categorySlug];
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { formatUsername } from "discourse/lib/utilities";
|
||||
|
@ -39,7 +40,7 @@ const checked = {};
|
|||
const cannotSee = [];
|
||||
|
||||
function updateFound($mentions, usernames) {
|
||||
Ember.run.scheduleOnce("afterRender", function() {
|
||||
scheduleOnce("afterRender", function() {
|
||||
$mentions.each((i, e) => {
|
||||
const $e = $(e);
|
||||
const username = usernames[i];
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { schedule } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { replaceSpan } from "discourse/lib/category-hashtags";
|
||||
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
||||
|
@ -7,7 +8,7 @@ const checkedTagHashtags = [];
|
|||
const testedClass = "tag-hashtag-tested";
|
||||
|
||||
function updateFound($hashtags, tagValues) {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
$hashtags.each((index, hashtag) => {
|
||||
const tagValue = tagValues[index];
|
||||
const link = validTagHashtags[tagValue];
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { run } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
const _loaded = {};
|
||||
const _loading = {};
|
||||
|
@ -22,7 +23,7 @@ function loadWithTag(path, cb) {
|
|||
) {
|
||||
s = s.onload = s.onreadystatechange = null;
|
||||
if (!abort) {
|
||||
Ember.run(null, cb);
|
||||
run(null, cb);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { next } from "@ember/runloop";
|
||||
let _started = false;
|
||||
let cache = {};
|
||||
let transitionCount = 0;
|
||||
|
@ -31,7 +32,7 @@ export function startPageTracking(router, appEvents) {
|
|||
|
||||
// Refreshing the title is debounced, so we need to trigger this in the
|
||||
// next runloop to have the correct title.
|
||||
Ember.run.next(() => {
|
||||
next(() => {
|
||||
let title = Discourse.get("_docTitle");
|
||||
|
||||
appEvents.trigger("page:changed", {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import {
|
||||
safariHacksDisabled,
|
||||
|
@ -94,7 +95,7 @@ function positioningWorkaround($fixedElement) {
|
|||
|
||||
if (!iOSWithVisualViewport()) {
|
||||
fixedElement.style.height = oldHeight;
|
||||
Ember.run.later(
|
||||
later(
|
||||
() => $(fixedElement).removeClass("no-transition"),
|
||||
500
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { bind } from "@ember/runloop";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
// We use this class to track how long posts in a topic are on the screen.
|
||||
|
@ -26,7 +27,7 @@ export default class {
|
|||
// Create an interval timer if we don't have one.
|
||||
if (!this._interval) {
|
||||
this._interval = setInterval(() => this.tick(), 1000);
|
||||
this._boundScrolled = Ember.run.bind(this, this.scrolled);
|
||||
this._boundScrolled = bind(this, this.scrolled);
|
||||
$(window).on("scroll.screentrack", this._boundScrolled);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue