Posted about 5 years ago. Visible to the public.

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.

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

Owner of this card:

Avatar
jan0sch
Last edit:
about 5 years ago
Keywords:
coffeescript
Posted by jan0sch to jan0sch's deck
This website uses cookies to improve usability and analyze traffic.
Accept or learn more