Skip to content

@briancavalier /join-promises.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fan-out promise resolution
function join(promises) {
var promise = new Promise();
promise.then(
function(val) {
for (var i = 0; i < promises.length; i++) {
promises[i].resolve(val);
}
},
function(err) {
for (var i = 0; i < promises.length; i++) {
promises[i].reject(err);
}
},
function(update) {
for (var i = 0; i < promises.length; i++) {
promises[i].progress(update);
}
}
);
return promise;
}
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.