gather
Control flow utility that runs a callback after all the dependencies are (asynchronously) met. Useful when a function depends on some resources that are obtained asynchronously and independently.
Example
var done = ; async { async { ; };}; async { ;}; // Prints "foobar".
API
feed = gather(done)
Returns a function that can feed results to done
.
Pass arguments as they become ready, interleaving with undefined
for not-yet-resolved ones. The order and total count matter.
Once all the arguments are supplied, done
is finally called.
Install
npm install gather
License
MIT