refactor: actionsFinished emit async
This commit is contained in:
parent
2694e79240
commit
707fa2ec4d
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user