Defined in: async-queuer.ts:94
• TValue
optional addItemsTo: QueuePosition;
optional addItemsTo: QueuePosition;
Defined in: async-queuer.ts:99
Default position to add items to the queuer
'back'
'back'
optional concurrency: number | (queuer) => number;
optional concurrency: number | (queuer) => number;
Defined in: async-queuer.ts:105
Maximum number of concurrent tasks to process. Can be a number or a function that returns a number.
1
1
optional expirationDuration: number;
optional expirationDuration: number;
Defined in: async-queuer.ts:110
Maximum time in milliseconds that an item can stay in the queue If not provided, items will never expire
optional getIsExpired: (item, addedAt) => boolean;
optional getIsExpired: (item, addedAt) => boolean;
Defined in: async-queuer.ts:115
Function to determine if an item has expired If provided, this overrides the expirationDuration behavior
TValue
number
boolean
optional getItemsFrom: QueuePosition;
optional getItemsFrom: QueuePosition;
Defined in: async-queuer.ts:120
Default position to get items from during processing
'front'
'front'
optional getPriority: (item) => number;
optional getPriority: (item) => number;
Defined in: async-queuer.ts:126
Function to determine priority of items in the queuer Higher priority items will be processed first If not provided, will use static priority values attached to tasks
TValue
number
optional initialItems: TValue[];
optional initialItems: TValue[];
Defined in: async-queuer.ts:130
Initial items to populate the queuer with
optional initialState: Partial<AsyncQueuerState<TValue>>;
optional initialState: Partial<AsyncQueuerState<TValue>>;
Defined in: async-queuer.ts:134
Initial state for the async queuer
optional maxSize: number;
optional maxSize: number;
Defined in: async-queuer.ts:138
Maximum number of items allowed in the queuer
optional onError: (error, queuer) => void;
optional onError: (error, queuer) => void;
Defined in: async-queuer.ts:144
Optional error handler for when a task throws. If provided, the handler will be called with the error and queuer instance. This can be used alongside throwOnError - the handler will be called before any error is thrown.
unknown
AsyncQueuer<TValue>
void
optional onExpire: (item, queuer) => void;
optional onExpire: (item, queuer) => void;
Defined in: async-queuer.ts:148
Callback fired whenever an item expires in the queuer
TValue
AsyncQueuer<TValue>
void
optional onItemsChange: (queuer) => void;
optional onItemsChange: (queuer) => void;
Defined in: async-queuer.ts:152
Callback fired whenever an item is added or removed from the queuer
AsyncQueuer<TValue>
void
optional onReject: (item, queuer) => void;
optional onReject: (item, queuer) => void;
Defined in: async-queuer.ts:156
Callback fired whenever an item is rejected from being added to the queuer
TValue
AsyncQueuer<TValue>
void
optional onSettled: (queuer) => void;
optional onSettled: (queuer) => void;
Defined in: async-queuer.ts:160
Optional callback to call when a task is settled
AsyncQueuer<TValue>
void
optional onSuccess: (result, queuer) => void;
optional onSuccess: (result, queuer) => void;
Defined in: async-queuer.ts:164
Optional callback to call when a task succeeds
TValue
AsyncQueuer<TValue>
void
optional started: boolean;
optional started: boolean;
Defined in: async-queuer.ts:168
Whether the queuer should start processing tasks immediately or not.
optional throwOnError: boolean;
optional throwOnError: boolean;
Defined in: async-queuer.ts:174
Whether to throw errors when they occur. Defaults to true if no onError handler is provided, false if an onError handler is provided. Can be explicitly set to override these defaults.
optional wait: number | (queuer) => number;
optional wait: number | (queuer) => number;
Defined in: async-queuer.ts:180
Time in milliseconds to wait between processing items. Can be a number or a function that returns a number.
0
0
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.