parent
08ebb97ea7
commit
23930871a1
2 changed files with 37 additions and 0 deletions
|
|
@ -1055,6 +1055,14 @@ var m = (function app(window, undefined) {
|
|||
return propify(promise.then(resolve, reject), initialValue);
|
||||
};
|
||||
prop["catch"] = prop.then.bind(null, null);
|
||||
prop["finally"] = function(callback){
|
||||
var _callback = function(value){return m.deferred().resolve(callback(value)).promise;};
|
||||
return prop.then(function(value) {
|
||||
return propify(_callback(value).then(function() {return value;}), initialValue);
|
||||
}, function(reason) {
|
||||
return propify(_callback(reason).then(function() {throw new Error(reason);}), initialValue);
|
||||
});
|
||||
};
|
||||
return prop;
|
||||
}
|
||||
//Promiz.mithril.js | Zolmeister | MIT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue