feat: Actions::tickingPromise
This commit is contained in:
parent
708c4fe25d
commit
3296f3d196
|
@ -113,21 +113,25 @@ export class Actions extends decorate(Traversals) {
|
|||
}
|
||||
|
||||
serial(context) {
|
||||
// Do a "dry" tick.
|
||||
// Immediate tick. Maybe we can avoid a promise?
|
||||
this.tick(context, 0);
|
||||
// If it's pending, we have to return a ticking promise.
|
||||
if (this.pending) {
|
||||
return new TickingPromise(
|
||||
(resolve) => {
|
||||
this.once('actionsFinished', () => {
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
(elapsed) => {
|
||||
this.tick(context, elapsed);
|
||||
},
|
||||
);
|
||||
return this.tickingPromise(context);
|
||||
}
|
||||
}
|
||||
|
||||
tickingPromise(context) {
|
||||
return new TickingPromise(
|
||||
(resolve) => {
|
||||
this.once('actionsFinished', () => {
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
(elapsed) => {
|
||||
this.tick(context, elapsed);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user