ed08ya
Last Updated: February 25, 2016
·
272
· jan0sch
2aaae7041aca85da930bcaf14d6768d2

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. :-)

Say Thanks
Respond