Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function asyncOperation() {
// returns promise
}
var promises = [];
for (var i=0; i<=10; i++) {
var promise = asyncOperation();
promises.push(promise);
}
// now we need to execute some logic after all promises get resolved
// we can use .all() as following
q
.all(promises)
.then(function() {
console.log('all promises resolved!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment