Defined in: async-queuer.ts:7
• TFn extends AsyncQueuerFn
optional addItemsTo: QueuePosition;
optional addItemsTo: QueuePosition;
Defined in: async-queuer.ts:12
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:18
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:23
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:28
Function to determine if an item has expired If provided, this overrides the expirationDuration behavior
TFn
number
boolean
optional getItemsFrom: QueuePosition;
optional getItemsFrom: QueuePosition;
Defined in: async-queuer.ts:33
Default position to get items from during processing
'front'
'front'
optional getPriority: (item) => number;
optional getPriority: (item) => number;
Defined in: async-queuer.ts:39
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
TFn
number
optional initialItems: TFn & object[];
optional initialItems: TFn & object[];
Defined in: async-queuer.ts:43
Initial items to populate the queuer with
optional maxSize: number;
optional maxSize: number;
Defined in: async-queuer.ts:47
Maximum number of items allowed in the queuer
optional onError: (error, queuer) => void;
optional onError: (error, queuer) => void;
Defined in: async-queuer.ts:53
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<TFn>
void
optional onExpire: (item, queuer) => void;
optional onExpire: (item, queuer) => void;
Defined in: async-queuer.ts:57
Callback fired whenever an item expires in the queuer
TFn
AsyncQueuer<TFn>
void
optional onGetNextItem: (item, queuer) => void;
optional onGetNextItem: (item, queuer) => void;
Defined in: async-queuer.ts:61
Callback fired whenever an item is removed from the queuer
TFn
AsyncQueuer<TFn>
void
optional onIsRunningChange: (queuer) => void;
optional onIsRunningChange: (queuer) => void;
Defined in: async-queuer.ts:65
Callback fired whenever the queuer's running state changes
AsyncQueuer<TFn>
void
optional onItemsChange: (queuer) => void;
optional onItemsChange: (queuer) => void;
Defined in: async-queuer.ts:69
Callback fired whenever an item is added or removed from the queuer
AsyncQueuer<TFn>
void
optional onReject: (item, queuer) => void;
optional onReject: (item, queuer) => void;
Defined in: async-queuer.ts:73
Callback fired whenever an item is rejected from being added to the queuer
TFn
AsyncQueuer<TFn>
void
optional onSettled: (queuer) => void;
optional onSettled: (queuer) => void;
Defined in: async-queuer.ts:77
Optional callback to call when a task is settled
AsyncQueuer<TFn>
void
optional onSuccess: (result, queuer) => void;
optional onSuccess: (result, queuer) => void;
Defined in: async-queuer.ts:81
Optional callback to call when a task succeeds
TFn
AsyncQueuer<TFn>
void
optional started: boolean;
optional started: boolean;
Defined in: async-queuer.ts:85
Whether the queuer should start processing tasks immediately or not.
optional throwOnError: boolean;
optional throwOnError: boolean;
Defined in: async-queuer.ts:91
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:97
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.