JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1120751
  • Score
    100M100P100Q179419F

Promise-based queue

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

[NPM Version] (https://npmjs.org/package/promise-queue) [Build Status] (https://travis-ci.org/azproduction/promise-queue) [Coverage Status] (https://coveralls.io/r/azproduction/promise-queue) [Dependency Status] (https://gemnasium.com/azproduction/promise-queue)

Promise-based queue

Installation

promise-queue can be installed using npm:

npm install promise-queue

Example

Queue.configure(function () {
    return $.Deferred() || require('vow').promise();
});

// max concurrent - 1
// max queue - Infinity
var queue = new Queue(1, Infinity);

queue.add(function () {
    // resolve of this promise will resume next request
    return downloadTarballFromGithub(url, file);
})
.then(function (file) {
    doStuffWith(file);
});

queue.add(function () {
    return downloadTarballFromGithub(url, file);
})
// This request will be paused
.then(function (file) {
    doStuffWith(file);
});