async-waiter
Higher-level functions to simplify waiting for multiple concurrent async operations to finish.
Install
npm install --save async-waiter
Example
waiter = require 'waiter' # Wait for `doFoo()` and `doBar()` to finish, then call `cb` = waiter doFoo wait doBar wait cb # Wait for all update() operations to finish = waiter user_idsforEach Userupdate user_iddatawait cb # The wait() function can delegate to a provided callback, # and the `this` context can be used to pass data to the callback = waiter UserloadUser user_idwait @data = userdata UserloadFriends user_idwait if err? then cb err else cb nullctxdatactxfriends
License
MIT