tarasm
October 10, 2013, 1:55pm
1
Continuing the discussion from Guide: When and how to handle asynchronous side-effects in testing? :
Hey guys… I am using normal Em.$.ajax() in my app using return Em.$.ajax(…).then(), but I started to look some presentations and materials talking about RSVP and promises. What is the best way to ensure that multiples requests follow a sequence and the second request wait to start when the first request ends? Sometimes I need to do two or more dependents Ajax requests.
Briefly, you want to look at Ember.RSVP.all() , Ember.RSVP.hash() and remember that when you return a promise from another promise’s callback, it will be resolved before the entire chain is resolved.
Stefan Penner does a great job of explaining Promises in September Boston Meetup .
1 Like