本页还没有译文
本页 126 段还没译成Español,下面显示的是英文原文。AsyncQueuerOptions
还没翻译译自英文(tanstack.com)本页 126 段都还没译
Defined in: async-queuer.ts:112
Type Parameters
TValue
TValue
Properties
addItemsTo?
optional addItemsTo?: QueuePosition;Defined in: async-queuer.ts:121
Default position to add items to the queuer
Default
'back'asyncRetryerOptions?
optional asyncRetryerOptions?: AsyncRetryerOptions<(item) => Promise<any>>;Defined in: async-queuer.ts:116
Options for configuring the underlying async retryer
concurrency?
optional concurrency?: number | ((queuer) => number);Defined in: async-queuer.ts:127
Maximum number of concurrent tasks to process. Can be a number or a function that returns a number.
Default
1expirationDuration?
optional expirationDuration?: number;Defined in: async-queuer.ts:132
Maximum time in milliseconds that an item can stay in the queue If not provided, items will never expire
getIsExpired?
optional getIsExpired?: (item, addedAt) => boolean;Defined in: async-queuer.ts:137
Function to determine if an item has expired If provided, this overrides the expirationDuration behavior
Parameters
item
TValue
addedAt
number
Returns
boolean
getItemsFrom?
optional getItemsFrom?: QueuePosition;Defined in: async-queuer.ts:142
Default position to get items from during processing
Default
'front'getPriority?
optional getPriority?: (item) => number;Defined in: async-queuer.ts:148
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
Parameters
item
TValue
Returns
number
initialItems?
optional initialItems?: TValue[];Defined in: async-queuer.ts:152
Initial items to populate the queuer with
initialState?
optional initialState?: Partial<AsyncQueuerState<TValue>>;Defined in: async-queuer.ts:156
Initial state for the async queuer
key?
optional key?: string;Defined in: async-queuer.ts:161
Optional key to identify this async queuer instance. If provided, the async queuer will be identified by this key in the devtools and PacerProvider if applicable.
maxSize?
optional maxSize?: number;Defined in: async-queuer.ts:165
Maximum number of items allowed in the queuer
onError?
optional onError?: (error, item, queuer) => void;Defined in: async-queuer.ts:171
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.
Parameters
error
Error
item
TValue
queuer
AsyncQueuer<TValue>
Returns
void
onExpire?
optional onExpire?: (item, queuer) => void;Defined in: async-queuer.ts:175
Callback fired whenever an item expires in the queuer
Parameters
item
TValue
queuer
AsyncQueuer<TValue>
Returns
void
onItemsChange?
optional onItemsChange?: (queuer) => void;Defined in: async-queuer.ts:179
Callback fired whenever an item is added or removed from the queuer
Parameters
queuer
AsyncQueuer<TValue>
Returns
void
onReject?
optional onReject?: (item, queuer) => void;Defined in: async-queuer.ts:183
Callback fired whenever an item is rejected from being added to the queuer
Parameters
item
TValue
queuer
AsyncQueuer<TValue>
Returns
void
onSettled?
optional onSettled?: (item, queuer) => void;Defined in: async-queuer.ts:187
Optional callback to call when a task is settled
Parameters
item
TValue
queuer
AsyncQueuer<TValue>
Returns
void
onSuccess?
optional onSuccess?: (result, item, queuer) => void;Defined in: async-queuer.ts:191
Optional callback to call when a task succeeds
Parameters
result
any
item
TValue
queuer
AsyncQueuer<TValue>
Returns
void
started?
optional started?: boolean;Defined in: async-queuer.ts:195
Whether the queuer should start processing tasks immediately or not.
throwOnError?
optional throwOnError?: boolean;Defined in: async-queuer.ts:201
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.
wait?
optional wait?: number | ((queuer) => number);Defined in: async-queuer.ts:207
Time in milliseconds to wait between processing items. Can be a number or a function that returns a number.
Default
0