Last Updated: February 25, 2016
·
597
· jan0sch

Bulk promises with EmberJS

I needed not to chain promises but to resolve a whole bunch of them together. The documentation was sparse so it took me a while to stumble upon the solution (Ember.RSVP.all). In case you need something like that here it is.

promises = someFancyStuff.map (resource) -> createPromise(resource)
Ember.RSVP.all(promises).then((results) -> doSomethingWithIt(results))

You can create an array of promises that you pass into Ember.RSVP.all which passes an array of the results into the .then chain. Actually quite simple. :-)