Skip to content

Instantly share code, notes, and snippets.

@yuchi
Created March 8, 2015 17:15
Show Gist options
  • Save yuchi/f84762a3743c117f2938 to your computer and use it in GitHub Desktop.
Save yuchi/f84762a3743c117f2938 to your computer and use it in GitHub Desktop.
Multiple requests with promises
var Promise = require('bluebird');
function provider(param) {
// questa funzione ritorna una promessa
}
// Tutte o il primo errore
Promise.all([ 'some', 'different', 'urls' ].map(provider));
// Un oggetto { value(), reason() } per ogni promessa
Promise.settle([ 'some', 'different', 'urls' ].map(provider));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment