Interface QueueManagerOptions<T>

interface QueueManagerOptions<T> {
    maxQueueSize?: number;
    nextDelay?: number;
    onAdd?: QueueCallbackFunction<T>;
    onClear?: (() => void | Promise<void>);
    onEmpty?: (() => void | Promise<void>);
    onProcessEnd?: QueueCallbackFunction<T>;
    onProcessStart?: QueueCallbackFunction<T>;
    onRemove?: QueueCallbackFunction<T>;
    processFunction?: QueueCallbackFunction<T>;
    skipProcessOnFull?: boolean;
    stopOnEmpty?: boolean;
    waitOnEmpty?: number;
}

Type Parameters

  • T

Implemented by

Properties

maxQueueSize?: number

The maximum number of items that can be stored in the queue

nextDelay?: number

The amount of time in ms to wait before retrieving the next item in the queue

Callback to run when an item is added to the queue

onClear?: (() => void | Promise<void>)

Callback to run when the queue is cleared

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

onEmpty?: (() => void | Promise<void>)

Callback to run when the queue is empty

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

onProcessEnd?: QueueCallbackFunction<T>

Callback to run when an item is processed

onProcessStart?: QueueCallbackFunction<T>

Callback to run when an item is about to be processed

Callback to run when an item is removed from the queue

processFunction?: QueueCallbackFunction<T>

The function to run on each item in the queue, before continuing to the next item

skipProcessOnFull?: boolean

Should we skip processing the first item in the queue when it's full and an item is added?

stopOnEmpty?: boolean

Should we stop processing once the queue is empty, or wait for more items to be added?

waitOnEmpty?: number

The amount of time to wait before resuming once the queue is empty