RSVP.Promise#finally()

finally (callback, label) Promise

Defined in bower_components/rsvp/lib/rsvp/promise.js:442

finally will be invoked regardless of the promise's fate just as native try/catch/finally behaves

Synchronous example:

findAuthor() {
  if (Math.random() > 0.5) {
    throw new Error();
  }
  return new Author();
}

try {
  return findAuthor(); // succeed or fail
} catch(error) {
  return findOtherAuther();
} finally {
  // always runs
  // doesn't affect the return value
}

Asynchronous example:

findAuthor().catch(function(reason){
  return findOtherAuther();
}).finally(function(){
  // author was either found, or not
});

Parameters:

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

Returns:

Promise
doc_EmberJs
2016-11-30 16:53:25
Comments
Leave a Comment

Please login to continue.