Skip to content

Instantly share code, notes, and snippets.

@yuchi
Created March 8, 2015 17:15
Show Gist options
  • Select an option

  • Save yuchi/f84762a3743c117f2938 to your computer and use it in GitHub Desktop.

Select an option

Save yuchi/f84762a3743c117f2938 to your computer and use it in GitHub Desktop.

Revisions

  1. yuchi created this gist Mar 8, 2015.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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));