mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
REFACTOR: Use imports for Ember.run
This commit is contained in:
@ -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