Package Exports
- promise-queue
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise-queue) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
promise-queue

Promise-based queue
Installation
promise-queue
can be installed using npm
:
npm install promise-queue
Example
Configure queue
By default Queue
tries to use global Promises, but you can specify your own promises.
Queue.configure(require('vow').Promise);
Or use old-style promises approach:
Queue.configure(function (handler) {
var dfd = $.Deferred();
try {
handler(dfd.resolve, dfd.reject, dfd.notify);
} catch (e) {
dfd.reject(e);
}
return dfd.promise();
});
Queue one by one example
var maxConcurrent = 1;
var maxQueue = Infinity;
var queue = new Queue(maxConcurrent, maxQueue);
app.get('/version/:user/:repo', function (req, res, next) {
queue.add(function () {
// Assume that this action is a way too expensive
// Call of this function will be delayed on second request
return downloadTarballFromGithub(req.params);
})
.then(parseJson('package.json'))
.then(function (package) {
res.send(package.version);
})
.catch(next);
});