fix: no emitters on server

This commit is contained in:
cha0s 2019-05-02 21:07:43 -05:00
parent dfb0d94bc2
commit 40ff470e74

View File

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