Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Promise chaining implementation of then()
Promise.prototype.then = function (onResolve, onReject, onProgress) {
if(isPromise(onResolve)) {
// Chain promise
this.then(
function(val) { onResolve.resolve(onReject ? onReject : val); },
function(err) { onResolve.reject(err); },
function(update) { onResolve.progress(update); }
);
} else {
// capture calls to then()
this._thens.push({ resolve: onResolve, reject: onReject, progress: onProgress });
onProgress && this._progress.push(onProgress);
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.