REFACTOR: Use imports for Ember.run

This commit is contained in:
Robin Ward
2019-10-29 14:52:36 -04:00
parent c7475ee03b
commit 5ca60fcb6b
151 changed files with 485 additions and 270 deletions

View File

@ -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

View File

@ -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);
},