Ember.Deferred is deprecated in Ember 1.7.0


#1

I’m using the method described in this Stackoverflow answer to execute API calls in a sequential order.

var root_promise = current_promise = Ember.Deferred.create(); 

current_promise = current_promise.then(function(){
  return // ...something that returns a promise...;
});

current_promise = current_promise.then(function(){
  return // ...something that returns a promise...;
});

// etc.

root_promise.resolve();

Ember.Deferred is deprecated in Ember 1.7.0. How can I write equivalent code now? I did some research, but couldn’t find the answer. Also, because I couldn’t find the RSVP API documentation on the Ember.js website anymore.


#2

Found the solution using the RSVP documentation on Github:

var root = Ember.RSVP.defer(),
currentPromise = root.promise;
...
room.resolve();

#3

Ember.RSVP.defer is not advised either.

Either use a normal RSVP.Promise or RSVP.resolve:

return Emver.RSVP.resolve()
  .then(function(){
    return // ...something that returns a promise...;
  })
  .then(function(){
    return // ...something that returns a promise...;
  });