limited-request-queue
Advanced tools
Comparing version 1.0.1 to 2.0.0
"use strict"; | ||
var getHostKey = require("./getHostKey"); | ||
var objectAssign = require("object-assign"); | ||
var defaultOptions = | ||
@@ -28,3 +26,3 @@ { | ||
this.handlers = handlers || {}; | ||
this.options = objectAssign({}, defaultOptions, options); | ||
this.options = Object.assign({}, defaultOptions, options); | ||
this.paused = false; | ||
@@ -77,3 +75,3 @@ } | ||
{ | ||
return this.priorityQueue.length; | ||
return this.priorityQueue.length + this.activeSockets; | ||
}; | ||
@@ -90,2 +88,9 @@ | ||
RequestQueue.prototype.numQueued = function() | ||
{ | ||
return this.priorityQueue.length; | ||
}; | ||
RequestQueue.prototype.pause = function() | ||
@@ -92,0 +97,0 @@ { |
{ | ||
"name": "limited-request-queue", | ||
"description": "Interactively manage concurrency for outgoing requests.", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -22,13 +22,13 @@ "homepage": "https://github.com/stevenvachon/limited-request-queue", | ||
"is-browser": "^2.0.1", | ||
"object-assign": "^4.0.1", | ||
"parse-domain": "~0.1.2" | ||
"parse-domain": "~0.2.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^11.2.0", | ||
"chai": "^3.3.0", | ||
"mocha": "^2.3.3", | ||
"browserify": "^12.0.1", | ||
"chai": "^3.4.1", | ||
"mocha": "^2.3.4", | ||
"mocha-phantomjs": "4.0.1", | ||
"phantomjs": "1.9.18", | ||
"uglify-js": "^2.5.0", | ||
"url-parse": "^1.0.4" | ||
"object.assign": "^4.0.3", | ||
"phantomjs": "1.9.19", | ||
"uglify-js": "^2.6.1", | ||
"url-parse": "^1.0.5" | ||
}, | ||
@@ -40,3 +40,3 @@ "engines": { | ||
"browserify": "browserify lib/ --exclude parse-domain --exclude url --standalone RequestQueue | uglifyjs --compress --mangle -o browser/requestqueue.js", | ||
"test_browser": "mocha-phantomjs test/browser.html", | ||
"test_browser": "npm run browserify && mocha-phantomjs test/browser.html", | ||
"test_server": "mocha test/server/ --reporter spec --check-leaks --bail", | ||
@@ -43,0 +43,0 @@ "test": "npm run test_server && npm run test_browser" |
@@ -9,3 +9,3 @@ # limited-request-queue [![NPM Version][npm-image]][npm-url] [![Bower Version][bower-image]][bower-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][david-image]][david-url] | ||
* Pause/Resume at any time | ||
* Works in the browser (~7KB) | ||
* Works in the browser (~6.5KB) | ||
@@ -38,3 +38,3 @@ ```js | ||
[Node.js](http://nodejs.org/) `>= 0.10` is required. To install, type this at the command line: | ||
[Node.js](http://nodejs.org/) `>= 0.10` is required; `< 4.0` will need an `Object.assign` polyfill. To install, type this at the command line: | ||
```shell | ||
@@ -66,7 +66,10 @@ npm install limited-request-queue --save-dev | ||
### .length() | ||
Returns the number of items in the queue. | ||
Returns the total number of items in the queue, active and non-active. | ||
### .numActive() | ||
Returns the number of active requests. | ||
Returns the number of items whose requests are currently in progress. | ||
### .numQueued() | ||
Returns the number of items that have not yet made requests. | ||
### .pause() | ||
@@ -73,0 +76,0 @@ Pauses the queue, but will not pause any active requests. |
13696
2
270
131
8
+ Addedparse-domain@0.2.2(transitive)
- Removedobject-assign@^4.0.1
- Removedobject-assign@4.1.1(transitive)
- Removedparse-domain@0.1.2(transitive)
Updatedparse-domain@~0.2.0