bluebird-as
A tiny number of helper functions to use with bluebird (other promise libraries not tested) for higher level functions such as sequence etc
Usage
var Promise = ; var as = ; as;
sequenceOf
Run Promises in strict sequence (without passing the result).
Note: In bluebird 2.x this is also available with
.each
javascript:
var urls = 'http://www.google.de'; Promise ;
coffeescript:
urls = 'http://www.google.de' Promiseresolveurls then assequenceOf scrapeUrlIntoDatabaseOrSourl then doSomethingWithAllResultsCollectedInDatabase
This is like async.eachSeries
sequenceWithParallelism
Run promises in sequence but with a degree of parallelism.
javascript:
var urls = 'http://www.google.de'; Promise ;
coffeescript:
urls = 'http://www.google.de' Promiseresolveurls then assequenceWithParallelism 10 scrapeUrlIntoDatabaseOrSourl then doSomethingWithAllResultsCollectedInDatabase
This is like async.eachLimit