Comparing version 1.0.2 to 1.1.0
@@ -13,2 +13,3 @@ type ActualTask<Task> = Task extends object ? Readonly<Task> : Task; | ||
precheck: (task: Task) => Promise<void> | void; | ||
onDrain: () => void; | ||
retryOnFailure: boolean; | ||
@@ -15,0 +16,0 @@ retryBeforeOtherTasks: boolean; |
@@ -7,6 +7,2 @@ "use strict"; | ||
class Suprqueue { | ||
// NOTE: Only non-primitive task types can be made readonly. | ||
// For example `Readonly<string>` results in `Readonly<{ toString: …, …}>` and TS will not even allow | ||
// the processTask function to be used to infer the string task type from `(task: string) => {}`, | ||
// requiring the `Readonly<string>` type instead. | ||
_processTask; | ||
@@ -29,2 +25,3 @@ _options; | ||
precheck: options.precheck ?? (() => { }), | ||
onDrain: options.onDrain ?? (() => { }), | ||
retryOnFailure: Boolean(options.retryOnFailure), | ||
@@ -81,2 +78,3 @@ retryBeforeOtherTasks: Boolean(options.retryBeforeOtherTasks), | ||
this._running = false; | ||
this._options.onDrain(); | ||
return; | ||
@@ -83,0 +81,0 @@ } |
{ | ||
"name": "suprqueue", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Simple in-memory promise-based task queue with support for pausing, merging tasks, or retrying failed tasks", | ||
"main": "dist/Suprqueue.js", | ||
"scripts": { | ||
"prepublish": "tsc", | ||
"prepublish": "tsc -p tsconfig.build.json", | ||
"test": "jest" | ||
@@ -9,0 +9,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
182481
3962