awaitqueue
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -13,3 +13,3 @@ export declare type AwaitQueueOptions = { | ||
}; | ||
export declare type AwaitQueueTask = (...args: any[]) => any; | ||
export declare type AwaitQueueTask<T> = () => Promise<T>; | ||
export declare class AwaitQueue { | ||
@@ -37,3 +37,3 @@ private closed; | ||
*/ | ||
push(task: AwaitQueueTask, name?: string): Promise<any>; | ||
push<T>(task: AwaitQueueTask<T>, name?: string): Promise<T>; | ||
/** | ||
@@ -46,3 +46,3 @@ * Make ongoing pending tasks reject with the given StoppedErrorClass error. | ||
dump(): { | ||
task: AwaitQueueTask; | ||
task: AwaitQueueTask<unknown>; | ||
name?: string; | ||
@@ -49,0 +49,0 @@ stopped: boolean; |
{ | ||
"name": "awaitqueue", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "JavaScript utility to enqueue async tasks for Node.js and the browser", | ||
@@ -24,5 +24,5 @@ "author": "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)", | ||
"@typescript-eslint/parser": "^3.5.0", | ||
"eslint": "^7.3.1", | ||
"eslint": "^7.9.0", | ||
"typescript": "~3.7.5" | ||
} | ||
} |
@@ -15,7 +15,7 @@ export type AwaitQueueOptions = | ||
export type AwaitQueueTask = (...args: any[]) => any; | ||
export type AwaitQueueTask<T> = () => Promise<T>; | ||
type PendingTask = | ||
{ | ||
task: AwaitQueueTask; | ||
task: AwaitQueueTask<unknown>; | ||
name?: string; | ||
@@ -92,3 +92,3 @@ resolve: (...args: any[]) => any; | ||
*/ | ||
async push(task: AwaitQueueTask, name?: string): Promise<any> | ||
async push<T>(task: AwaitQueueTask<T>, name?: string): Promise<T> | ||
{ | ||
@@ -151,3 +151,3 @@ if (this.closed) | ||
dump(): { task: AwaitQueueTask; name?: string; stopped: boolean }[] | ||
dump(): { task: AwaitQueueTask<unknown>; name?: string; stopped: boolean }[] | ||
{ | ||
@@ -154,0 +154,0 @@ return this.pendingTasks.map((pendingTask) => |
Sorry, the diff of this file is not supported yet
23723