Commit e2637115 authored by Tristan Cavelier's avatar Tristan Cavelier

replicatestorage useful method added

parent bb5bebfb
......@@ -669,6 +669,40 @@
return this;
};
/**
* always(callback): Promise
*
* Call the callback on resolve or on reject.
*
* sayHello().
* done(iAnswer).
* fail(iHeardNothing).
* always(iKeepWalkingAnyway);
*
* @method always
* @param {Function} callback The callback to call on resolve or on reject
* @return {Promise} This promise
*/
Promise.prototype.always = function (callback) {
var that = this;
if (typeof callback !== 'function') {
return this;
}
switch (this._state) {
case "resolved":
case "rejected":
setTimeout(function () {
callback.apply(that, that._answers);
});
break;
default:
that._onReject.push(callback);
that._onResolve.push(callback);
break;
}
return this;
};
/**
* firstDone(*items): Promise
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment