Actions::serial
This commit is contained in:
parent
1bd7bc41a3
commit
9239d5b2e6
|
@ -30,6 +30,10 @@ export class Globals {
|
|||
return min + (floor ? Math.floor(mag) : mag);
|
||||
}
|
||||
|
||||
serial(actions, context) {
|
||||
return actions.serial(context);
|
||||
}
|
||||
|
||||
testing() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -114,4 +114,23 @@ export class Actions extends decorate(Traversals) {
|
|||
}
|
||||
}
|
||||
|
||||
serial(context) {
|
||||
// Do a "dry" tick.
|
||||
this.tick(context, 0);
|
||||
// If it's pending, we have to return a ticking promise.
|
||||
if (this.pending) {
|
||||
let resolve_;
|
||||
const tickingPromise = new TickingPromise((resolve) => {
|
||||
resolve_ = resolve;
|
||||
});
|
||||
tickingPromise.ticker = (elapsed) => {
|
||||
this.tick(context, elapsed);
|
||||
}
|
||||
this.once('actionsFinished', () => {
|
||||
resolve_();
|
||||
});
|
||||
return tickingPromise;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user