refactor: simplify flow
This commit is contained in:
parent
b591e5b08f
commit
f6a461d2d5
|
@ -70,16 +70,10 @@ export class Actions extends decorate(Traversals) {
|
|||
}
|
||||
|
||||
parallel(context) {
|
||||
let immediate = true;
|
||||
const results = this.traversals.map((traversal) => {
|
||||
const result = traversal.traverse(context);
|
||||
// Side-effect for performance.
|
||||
if (result instanceof Promise) {
|
||||
immediate = false;
|
||||
}
|
||||
return result;
|
||||
return traversal.traverse(context);
|
||||
});
|
||||
return immediate ? results : TickingPromise.all(results);
|
||||
return TickingPromise.all(results);
|
||||
}
|
||||
|
||||
prologue() {
|
||||
|
@ -90,12 +84,7 @@ export class Actions extends decorate(Traversals) {
|
|||
}
|
||||
|
||||
serial(context) {
|
||||
// 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 this.tickingPromise(context);
|
||||
}
|
||||
return this.tickingPromise(context);
|
||||
}
|
||||
|
||||
tickingPromise(context) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user