Skip to content

Commit

Permalink
Add catch & finally methods to Transition
Browse files Browse the repository at this point in the history
Add label parameter to the then method
  • Loading branch information
Ken Browning committed Aug 7, 2014
1 parent a666cc9 commit 83f33ba
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions lib/router/transition.js
Expand Up @@ -126,11 +126,48 @@ Transition.prototype = {
use in situations where you want to pass around a thennable,
but not the Transition itself.
@param {Function} success
@param {Function} failure
@param {Function} onFulfilled
@param {Function} onRejected
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise}
*/
then: function(success, failure) {
return this.promise.then(success, failure);
then: function(onFulfilled, onRejected, label) {
return this.promise.then(onFulfilled, onRejected, label);
},

/**
@public
Forwards to the internal `promise` property which you can
use in situations where you want to pass around a thennable,
but not the Transition itself.
@method catch
@param {Function} onRejection
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise}
*/
catch: function(onRejection, label) {
return this.promise.catch(onRejection, label);
},

/**
@public
Forwards to the internal `promise` property which you can
use in situations where you want to pass around a thennable,
but not the Transition itself.
@method finally
@param {Function} callback
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise}
*/
finally: function(callback, label) {
return this.promise.finally(callback, label);
},

/**
Expand Down

0 comments on commit 83f33ba

Please sign in to comment.