Framework
Version
Debouncer API Reference
Throttler API Reference
Rate Limiter API Reference
Queue API Reference
Batcher API Reference

QueuerOptions

Interface: QueuerOptions<TValue>

Defined in: queuer.ts:8

Options for configuring a Queuer instance.

These options control queue behavior, item expiration, callbacks, and more.

Type Parameters

TValue

Properties

addItemsTo?

ts
optional addItemsTo: QueuePosition;
optional addItemsTo: QueuePosition;

Defined in: queuer.ts:13

Default position to add items to the queuer

Default

ts
'back'
'back'

expirationDuration?

ts
optional expirationDuration: number;
optional expirationDuration: number;

Defined in: queuer.ts:18

Maximum time in milliseconds that an item can stay in the queue If not provided, items will never expire


getIsExpired()?

ts
optional getIsExpired: (item, addedAt) => boolean;
optional getIsExpired: (item, addedAt) => boolean;

Defined in: queuer.ts:23

Function to determine if an item has expired If provided, this overrides the expirationDuration behavior

Parameters

item

TValue

addedAt

number

Returns

boolean


getItemsFrom?

ts
optional getItemsFrom: QueuePosition;
optional getItemsFrom: QueuePosition;

Defined in: queuer.ts:28

Default position to get items from during processing

Default

ts
'front'
'front'

getPriority()?

ts
optional getPriority: (item) => number;
optional getPriority: (item) => number;

Defined in: queuer.ts:33

Function to determine priority of items in the queuer Higher priority items will be processed first

Parameters

item

TValue

Returns

number


initialItems?

ts
optional initialItems: TValue[];
optional initialItems: TValue[];

Defined in: queuer.ts:37

Initial items to populate the queuer with


maxSize?

ts
optional maxSize: number;
optional maxSize: number;

Defined in: queuer.ts:41

Maximum number of items allowed in the queuer


onExecute()?

ts
optional onExecute: (item, queuer) => void;
optional onExecute: (item, queuer) => void;

Defined in: queuer.ts:49

Callback fired whenever an item is removed from the queuer

Parameters

item

TValue

queuer

Queuer<TValue>

Returns

void


onExpire()?

ts
optional onExpire: (item, queuer) => void;
optional onExpire: (item, queuer) => void;

Defined in: queuer.ts:45

Callback fired whenever an item expires in the queuer

Parameters

item

TValue

queuer

Queuer<TValue>

Returns

void


onIsRunningChange()?

ts
optional onIsRunningChange: (queuer) => void;
optional onIsRunningChange: (queuer) => void;

Defined in: queuer.ts:53

Callback fired whenever the queuer's running state changes

Parameters

queuer

Queuer<TValue>

Returns

void


onItemsChange()?

ts
optional onItemsChange: (queuer) => void;
optional onItemsChange: (queuer) => void;

Defined in: queuer.ts:57

Callback fired whenever an item is added or removed from the queuer

Parameters

queuer

Queuer<TValue>

Returns

void


onReject()?

ts
optional onReject: (item, queuer) => void;
optional onReject: (item, queuer) => void;

Defined in: queuer.ts:61

Callback fired whenever an item is rejected from being added to the queuer

Parameters

item

TValue

queuer

Queuer<TValue>

Returns

void


started?

ts
optional started: boolean;
optional started: boolean;

Defined in: queuer.ts:65

Whether the queuer should start processing tasks immediately


wait?

ts
optional wait: number | (queuer) => number;
optional wait: number | (queuer) => number;

Defined in: queuer.ts:71

Time in milliseconds to wait between processing items. Can be a number or a function that returns a number.

Default

ts
0
0
Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.