@sapphire/async-queue
Advanced tools
Comparing version 1.5.3-next.153efa1d.0 to 1.5.3-next.19fc57ed
@@ -7,8 +7,5 @@ var SapphireAsyncQueue = (function (exports) { | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
// src/lib/AsyncQueueEntry.ts | ||
// src/lib/_AsyncQueueEntry.ts | ||
var _AsyncQueueEntry = class _AsyncQueueEntry { | ||
@@ -29,9 +26,7 @@ constructor(queue) { | ||
setSignal(signal) { | ||
if (signal.aborted) | ||
return this; | ||
if (signal.aborted) return this; | ||
this.signal = signal; | ||
this.signalListener = () => { | ||
const index = this.queue["promises"].indexOf(this); | ||
if (index !== -1) | ||
this.queue["promises"].splice(index, 1); | ||
if (index !== -1) this.queue["promises"].splice(index, 1); | ||
this.reject(new Error("Request aborted manually")); | ||
@@ -113,4 +108,3 @@ }; | ||
this.promises.push(entry); | ||
if (options?.signal) | ||
entry.setSignal(options.signal); | ||
if (options?.signal) entry.setSignal(options.signal); | ||
return entry.promise; | ||
@@ -122,4 +116,3 @@ } | ||
shift() { | ||
if (this.promises.length === 0) | ||
return; | ||
if (this.promises.length === 0) return; | ||
if (this.promises.length === 1) { | ||
@@ -137,4 +130,3 @@ this.promises.shift(); | ||
abortAll() { | ||
if (this.queued === 0) | ||
return; | ||
if (this.queued === 0) return; | ||
for (let i = 1; i < this.promises.length; ++i) { | ||
@@ -141,0 +133,0 @@ this.promises[i].abort(); |
{ | ||
"name": "@sapphire/async-queue", | ||
"version": "1.5.3-next.153efa1d.0", | ||
"version": "1.5.3-next.19fc57ed", | ||
"description": "Sequential asynchronous lock-based queue for promises", | ||
@@ -29,7 +29,8 @@ "author": "@sapphire", | ||
"docs": "typedoc-json-parser", | ||
"build": "tsup && yarn build:rename-cjs-index", | ||
"build:rename-cjs-index": "tsx --tsconfig ../../scripts/tsconfig.json ../../scripts/rename-cjs-index.cts", | ||
"build": "yarn gen-index && tsup && yarn build:rename-cjs-index", | ||
"build:rename-cjs-index": "tsx ../../scripts/rename-cjs-index.cts", | ||
"prepack": "yarn build", | ||
"bump": "cliff-jumper", | ||
"check-update": "cliff-jumper --dry-run" | ||
"check-update": "cliff-jumper --dry-run", | ||
"gen-index": "tsx ../../scripts/gen-index.cts -w async-queue" | ||
}, | ||
@@ -65,11 +66,11 @@ "repository": { | ||
"devDependencies": { | ||
"@favware/cliff-jumper": "^3.0.1", | ||
"@vitest/coverage-v8": "^1.4.0", | ||
"tsup": "^8.0.2", | ||
"tsx": "^4.7.1", | ||
"typedoc": "^0.25.12", | ||
"typedoc-json-parser": "^9.0.1", | ||
"typescript": "^5.4.2", | ||
"vitest": "^1.4.0" | ||
"@favware/cliff-jumper": "^4.0.2", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"tsup": "^8.1.0", | ||
"tsx": "^4.14.1", | ||
"typedoc": "^0.25.13", | ||
"typedoc-json-parser": "^10.0.0", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.6.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
52468
398