refactor: simply
This commit is contained in:
parent
0a3e1848f4
commit
1af713cfb8
|
@ -15,26 +15,7 @@ export class Traversals extends Collection('traversal') {
|
|||
}, false)) {
|
||||
return results;
|
||||
}
|
||||
// Proxy any tickers.
|
||||
const tickableResults = results.filter((result) => {
|
||||
if (!(result instanceof TickingPromise)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// If none, just promise.
|
||||
if (0 === tickableResults.length) {
|
||||
return Promise.all(results);
|
||||
}
|
||||
// Otherwise, tick all tickers and resolve.
|
||||
return new TickingPromise(
|
||||
(resolve) => {
|
||||
resolve(Promise.all(results));
|
||||
},
|
||||
(elapsed) => {
|
||||
tickableResults.forEach((result) => result.tick(elapsed));
|
||||
},
|
||||
);
|
||||
return TickingPromise.all(results);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user