Promising job queue
Run promises in series or with a configurable concurrency limit
$ npm install --save worq
const Queue = require('worq');
let queue = new Queue();
queue.run([
() => somePromisingFunction(),
() => someOtherPromisingFunction(),
() => someNormalFunction()
// these functions will be executed in series
]).then(results => {
// results will be an array containing the return / fulfillment values
});
Type: number
Default: 1
The maximum number of jobs that can run simultaneously
Type: Function[]
An array of jobs. Jobs may return/throw regularly or return a promise.
Returns a promise for an array containing the fulfillment values in the same order.
Cancels the remaining jobs.
MIT © JM Versteeg