Skip to main content
Version: Next

AsyncQueue

AsyncQueue

Signature
class AsyncQueue {
constructor(options: AsyncQueueOptions = {})
add(task: AsyncQueueTask<T>, signal?: AbortSignal) => Promise<T>;
pause() => ;
resume() => ;
abort() => ;
clear() => ;
getRunning() => number;
getPending() => number;
isPaused() => boolean;
isAborted() => boolean;
}

constructor

method
(options: AsyncQueueOptions = {}) => AsyncQueue

add

method
(task: AsyncQueueTask<T>, signal?: AbortSignal) => Promise<T>

Adds a task to the queue.

pause

method
() =>

Pauses the queue. No new tasks will be started until resumed.

resume

method
() =>

Resumes the queue and processes pending tasks.

abort

method
() =>

Aborts the queue, rejecting all pending tasks.

clear

method
() =>

Clears all pending tasks from the queue.

getRunning

method
() => number

Returns the number of running tasks.

getPending

method
() => number

Returns the number of pending tasks in the queue.

isPaused

method
() => boolean

Returns true if the queue is currently paused.

isAborted

method
() => boolean

Returns true if the queue has been aborted.