refactor: destroy async to avoid issues within tick

This commit is contained in:
cha0s 2019-10-08 03:23:58 -05:00
parent 2b3fca9d9a
commit 0a7c60e8b7

View File

@ -36,8 +36,10 @@ export class Existent extends decorate(Trait) {
}
this._isDestroying = true;
this.entity.isTicking = false;
return Promise.resolve().then(() => {
this.entity.emit('destroy');
this.entity.emit('destroyed');
});
},
destroyGently: () => {