Comparing version 6.2.0 to 6.2.1
@@ -28,4 +28,4 @@ import EventEmitter = require('eventemitter3'); | ||
constructor(options?: Options<QueueType, EnqueueOptionsType>); | ||
private readonly _doesIntervalAllowAnother; | ||
private readonly _doesConcurrentAllowAnother; | ||
private get _doesIntervalAllowAnother(); | ||
private get _doesConcurrentAllowAnother(); | ||
private _next; | ||
@@ -42,3 +42,4 @@ private _resolvePromises; | ||
private _processQueue; | ||
concurrency: number; | ||
get concurrency(): number; | ||
set concurrency(newConcurrency: number); | ||
/** | ||
@@ -81,16 +82,17 @@ Adds a sync or async task to the queue. Always returns a promise. | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
Number of pending promises. | ||
*/ | ||
readonly pending: number; | ||
get pending(): number; | ||
/** | ||
Whether the queue is currently paused. | ||
*/ | ||
readonly isPaused: boolean; | ||
get isPaused(): boolean; | ||
/** | ||
Set the timeout for future operations. | ||
*/ | ||
timeout: number | undefined; | ||
set timeout(milliseconds: number | undefined); | ||
get timeout(): number | undefined; | ||
} | ||
export { Queue, QueueAddOptions, DefaultAddOptions, Options }; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const empty = () => { }; | ||
const timeoutError = new p_timeout_1.default.TimeoutError(); | ||
const timeoutError = new p_timeout_1.TimeoutError(); | ||
/** | ||
@@ -15,7 +15,105 @@ Promise queue with concurrency control. | ||
super(); | ||
this._intervalCount = 0; | ||
this._intervalEnd = 0; | ||
this._pendingCount = 0; | ||
this._resolveEmpty = empty; | ||
this._resolveIdle = empty; | ||
Object.defineProperty(this, "_carryoverConcurrencyCount", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_isIntervalIgnored", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_intervalCount", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: 0 | ||
}); | ||
Object.defineProperty(this, "_intervalCap", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_interval", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_intervalEnd", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: 0 | ||
}); | ||
Object.defineProperty(this, "_intervalId", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_timeoutId", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_queue", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_queueClass", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_pendingCount", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: 0 | ||
}); | ||
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194 | ||
Object.defineProperty(this, "_concurrency", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_isPaused", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_resolveEmpty", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: empty | ||
}); | ||
Object.defineProperty(this, "_resolveIdle", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: empty | ||
}); | ||
Object.defineProperty(this, "_timeout", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "_throwOnTimeout", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion | ||
@@ -22,0 +120,0 @@ options = Object.assign({ carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priority_queue_1.default }, options |
@@ -10,3 +10,3 @@ import { Queue, RunFunction } from './queue'; | ||
dequeue(): RunFunction | undefined; | ||
readonly size: number; | ||
get size(): number; | ||
} |
@@ -6,3 +6,8 @@ "use strict"; | ||
constructor() { | ||
this._queue = []; | ||
Object.defineProperty(this, "_queue", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: [] | ||
}); | ||
} | ||
@@ -9,0 +14,0 @@ enqueue(run, options) { |
{ | ||
"name": "p-queue", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "Promise queue with concurrency control", | ||
@@ -48,5 +48,5 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^0.5.0", | ||
"@sindresorhus/tsconfig": "^0.6.0", | ||
"@types/benchmark": "^1.0.31", | ||
"@types/node": "^12.0.10", | ||
"@types/node": "^12.12.7", | ||
"@typescript-eslint/eslint-plugin": "^1.11.0", | ||
@@ -59,3 +59,3 @@ "@typescript-eslint/parser": "^1.11.0", | ||
"delay": "^4.2.0", | ||
"eslint-config-xo-typescript": "^0.15.0", | ||
"eslint-config-xo-typescript": "^0.16.0", | ||
"in-range": "^2.0.0", | ||
@@ -66,3 +66,3 @@ "nyc": "^14.0.0", | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.6.4", | ||
"typescript": "^3.7.2", | ||
"xo": "^0.25.3" | ||
@@ -89,6 +89,6 @@ }, | ||
"rules": { | ||
"import/first": "off", | ||
"import/newline-after-import": "off", | ||
"@typescript-eslint/member-ordering": "off", | ||
"@typescript-eslint/strict-boolean-expressions": "off" | ||
"@typescript-eslint/strict-boolean-expressions": "off", | ||
"@typescript-eslint/require-await": "off", | ||
"@typescript-eslint/no-misused-promises": "off" | ||
} | ||
@@ -95,0 +95,0 @@ }, |
@@ -55,4 +55,4 @@ # p-queue [![Build Status](https://travis-ci.org/sindresorhus/p-queue.svg?branch=master)](https://travis-ci.org/sindresorhus/p-queue) [![codecov](https://codecov.io/gh/sindresorhus/p-queue/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/p-queue) | ||
Type: `number`<br> | ||
Default: `Infinity`<br> | ||
Type: `number`\ | ||
Default: `Infinity`\ | ||
Minimum: `1` | ||
@@ -70,3 +70,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `false` | ||
@@ -78,3 +78,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -92,4 +92,4 @@ | ||
Type: `number`<br> | ||
Default: `Infinity`<br> | ||
Type: `number`\ | ||
Default: `Infinity`\ | ||
Minimum: `1` | ||
@@ -101,4 +101,4 @@ | ||
Type: `number`<br> | ||
Default: `0`<br> | ||
Type: `number`\ | ||
Default: `0`\ | ||
Minimum: `0` | ||
@@ -110,3 +110,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `false` | ||
@@ -120,3 +120,3 @@ | ||
#### .add(fn, [options]) | ||
#### .add(fn, options?) | ||
@@ -133,7 +133,7 @@ Adds a sync or async task to the queue. Always returns a promise. | ||
Type: `Object` | ||
Type: `object` | ||
##### priority | ||
Type: `number`<br> | ||
Type: `number`\ | ||
Default: `0` | ||
@@ -143,3 +143,3 @@ | ||
#### .addAll(fns, [options]) | ||
#### .addAll(fns, options?) | ||
@@ -146,0 +146,0 @@ Same as `.add()`, but accepts an array of sync or async functions and returns a promise that resolves when all functions are resolved. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30258
581