diff --git a/packages/behavior/item/actions.js b/packages/behavior/item/actions.js index 5d51ce9..acc9701 100644 --- a/packages/behavior/item/actions.js +++ b/packages/behavior/item/actions.js @@ -17,6 +17,12 @@ export class Actions extends decorate(Traversals) { this.pending = null; } + emitFinishedAsync() { + setTimeout(() => { + this.emit('actionsFinished'); + }, 0); + } + get index() { return this._index; } @@ -27,7 +33,7 @@ export class Actions extends decorate(Traversals) { tick(context, elapsed) { if (this.traversals.length === 0) { - this.emit('actionsFinished'); + this.emitFinishedAsync(); return; } if ( @@ -61,7 +67,7 @@ export class Actions extends decorate(Traversals) { prologue() { this.pending = null; if (0 === (this.index = (this.index + 1) % this.traversals.length)) { - this.emit('actionsFinished'); + this.emitFinishedAsync(); } }