RSVP.defer()

defer (label) Objectstatic

Defined in bower_components/rsvp/lib/rsvp/defer.js:3

RSVP.defer returns an object similar to jQuery's $.Deferred. RSVP.defer should be used when porting over code reliant on $.Deferred's interface. New code should use the RSVP.Promise constructor instead.

The object returned from RSVP.defer is a plain object with three properties:

  • promise - an RSVP.Promise.
  • reject - a function that causes the promise property on this object to become rejected
  • resolve - a function that causes the promise property on this object to become fulfilled.

Example:

 var deferred = RSVP.defer();

 deferred.resolve("Success!");

 deferred.promise.then(function(value){
   // value here is "Success!"
 });

Parameters:

label String
optional string for labeling the promise. Useful for tooling.

Returns:

Object
doc_EmberJs
2016-11-30 16:53:21
Comments
Leave a Comment

Please login to continue.