fix: no emitters on server
This commit is contained in:
parent
dfb0d94bc2
commit
40ff470e74
|
@ -53,9 +53,9 @@ export class Emitter extends decorate(Trait) {
|
|||
}
|
||||
|
||||
hooks() {
|
||||
return {
|
||||
|
||||
afterDestructionTickers: () => {
|
||||
const hooks = {};
|
||||
if (AVOCADO_CLIENT) {
|
||||
hooks.afterDestructionTickers = () => {
|
||||
return (elapsed) => {
|
||||
for (const key in this.emitters) {
|
||||
const emitter = this.emitters[key];
|
||||
|
@ -68,20 +68,26 @@ export class Emitter extends decorate(Trait) {
|
|||
}
|
||||
return 0 === Object.keys(this.emitters).length;
|
||||
};
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
return hooks;
|
||||
}
|
||||
|
||||
methods() {
|
||||
return {
|
||||
|
||||
addEmitter: (key, emitter) => {
|
||||
if (AVOCADO_SERVER) {
|
||||
return;
|
||||
}
|
||||
this.emitters[key] = emitter;
|
||||
this.constructor.addEmitter(emitter);
|
||||
},
|
||||
|
||||
addEmitterRenderer: (key, renderer) => {
|
||||
if (AVOCADO_SERVER) {
|
||||
return;
|
||||
}
|
||||
if (!this.emitters[key]) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user