-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The goal of that iterator is to take a number of promises in unknown states, and generate their results in the order of these promises resolving/rejecting. This commit changes the implementation in such a way that we do not need an event emitter *and* a result queue and a (fairly complex) logic of synchronizing these. Instead the iterator builds two parallel queues, one containing unresolved promises and one containing the resolve and reject functions for these promises. The incoming promises then are configured to pop the next {resolve, reject} structure, and call that with the respective result. The iterator at the same time picks the next unresolved promise from its own queue and yields that.
- Loading branch information
Showing
1 changed file
with
50 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters