mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 08:11:50 +08:00
Revert "Revert Ember.run refactors"
This reverts commit fcb1ca52f96bdff1a49d558a4ffb18107d8334de.
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/* global Pikaday:true */
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
@ -55,7 +56,7 @@ export default Component.extend({
|
||||
if (markup) {
|
||||
cookAsync(markup).then(result => {
|
||||
this.set("currentPreview", result);
|
||||
Ember.run.schedule("afterRender", () =>
|
||||
schedule("afterRender", () =>
|
||||
this.$(".preview .discourse-local-date").applyLocalDates()
|
||||
);
|
||||
});
|
||||
@ -409,7 +410,7 @@ export default Component.extend({
|
||||
date = null;
|
||||
}
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this._picker.setMinDate(moment(date, this.dateFormat).toDate());
|
||||
});
|
||||
},
|
||||
@ -419,7 +420,7 @@ export default Component.extend({
|
||||
date = null;
|
||||
}
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
this._picker.setDate(moment.utc(date), true);
|
||||
});
|
||||
},
|
||||
|
@ -1,3 +1,6 @@
|
||||
import { once } from "@ember/runloop";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import {
|
||||
@ -26,12 +29,12 @@ export default Component.extend({
|
||||
@on("didInsertElement")
|
||||
composerOpened() {
|
||||
this._lastPublish = new Date();
|
||||
Ember.run.once(this, "updateState");
|
||||
once(this, "updateState");
|
||||
},
|
||||
|
||||
@observes("action", "post.id", "topic.id")
|
||||
composerStateChanged() {
|
||||
Ember.run.once(this, "updateState");
|
||||
once(this, "updateState");
|
||||
},
|
||||
|
||||
@observes("reply", "title")
|
||||
@ -44,8 +47,8 @@ export default Component.extend({
|
||||
@on("willDestroyElement")
|
||||
composerClosing() {
|
||||
this.publish({ previous: this.currentState });
|
||||
Ember.run.cancel(this._pingTimer);
|
||||
Ember.run.cancel(this._clearTimer);
|
||||
cancel(this._pingTimer);
|
||||
cancel(this._clearTimer);
|
||||
},
|
||||
|
||||
updateState() {
|
||||
@ -94,7 +97,7 @@ export default Component.extend({
|
||||
r.messagebus_channel,
|
||||
message => {
|
||||
if (!this.isDestroyed) this.set("presenceUsers", message.users);
|
||||
this._clearTimer = Ember.run.debounce(
|
||||
this._clearTimer = debounce(
|
||||
this,
|
||||
"clear",
|
||||
keepAliveDuration + bufferTime
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { debounce } from "@ember/runloop";
|
||||
import { cancel } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
@ -26,7 +28,7 @@ export default Component.extend({
|
||||
this.channel,
|
||||
message => {
|
||||
if (!this.isDestroyed) this.set("presenceUsers", message.users);
|
||||
this._clearTimer = Ember.run.debounce(
|
||||
this._clearTimer = debounce(
|
||||
this,
|
||||
"clear",
|
||||
keepAliveDuration + bufferTime
|
||||
@ -38,7 +40,7 @@ export default Component.extend({
|
||||
|
||||
@on("willDestroyElement")
|
||||
_destroyed() {
|
||||
Ember.run.cancel(this._clearTimer);
|
||||
cancel(this._clearTimer);
|
||||
this.messageBus.unsubscribe(this.channel);
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user