定义于: async-queuer.ts:100
• TValue
optional addItemsTo: QueuePosition;
optional addItemsTo: QueuePosition;
定义于: async-queuer.ts:105
将项目添加到队列的默认位置
'back'
'back'
optional concurrency: number | (queuer) => number;
optional concurrency: number | (queuer) => number;
定义于: async-queuer.ts:111
同时处理的最大任务数。可以是数字或返回数字的函数。
1
1
optional expirationDuration: number;
optional expirationDuration: number;
定义于: async-queuer.ts:116
项目在队列中可以停留的最大毫秒数。如果未提供,项目将永远不会过期。
optional getIsExpired: (item, addedAt) => boolean;
optional getIsExpired: (item, addedAt) => boolean;
定义于: async-queuer.ts:121
确定项目是否已过期的函数。如果提供,这将覆盖 expirationDuration 的行为。
TValue
number
boolean
optional getItemsFrom: QueuePosition;
optional getItemsFrom: QueuePosition;
定义于: async-queuer.ts:126
处理过程中从中获取项目的默认位置
'front'
'front'
optional getPriority: (item) => number;
optional getPriority: (item) => number;
定义于: async-queuer.ts:132
确定队列中项目优先级的函数。优先级较高的项目将首先处理。如果未提供,将使用附加到任务的静态优先级值。
TValue
number
optional initialItems: TValue[];
optional initialItems: TValue[];
定义于: async-queuer.ts:136
用于填充队列的初始项目。
optional initialState: Partial<AsyncQueuerState<TValue>>;
optional initialState: Partial<AsyncQueuerState<TValue>>;
定义于: async-queuer.ts:140
异步队列的初始状态。
optional key: string;
optional key: string;
定义于: async-queuer.ts:145
可选键,用于标识此异步队列实例。如果提供,异步队列将在开发者工具和 PacerProvider(如果适用)中通过此键进行标识。
optional maxSize: number;
optional maxSize: number;
定义于: async-queuer.ts:149
队列中允许的最大项目数。
optional onError: (error, item, queuer) => void;
optional onError: (error, item, queuer) => void;
定义于: async-queuer.ts:155
当任务抛出错误时,可选的错误处理程序。如果提供,将使用错误和队列实例调用处理程序。这可以与 throwOnError 一起使用 - 在抛出任何错误之前将调用处理程序。
unknown
TValue
AsyncQueuer<TValue>
void
optional onExpire: (item, queuer) => void;
optional onExpire: (item, queuer) => void;
定义于: async-queuer.ts:159
每当队列中的项目过期时触发的回调。
TValue
AsyncQueuer<TValue>
void
optional onItemsChange: (queuer) => void;
optional onItemsChange: (queuer) => void;
定义于: async-queuer.ts:163
每当项目被添加或从队列中移除时触发的回调。
AsyncQueuer<TValue>
void
optional onReject: (item, queuer) => void;
optional onReject: (item, queuer) => void;
定义于: async-queuer.ts:167
每当项目被拒绝添加进队列时触发的回调。
TValue
AsyncQueuer<TValue>
void
optional onSettled: (item, queuer) => void;
optional onSettled: (item, queuer) => void;
定义于: async-queuer.ts:171
任务结算时调用的可选回调。
TValue
AsyncQueuer<TValue>
void
optional onSuccess: (result, item, queuer) => void;
optional onSuccess: (result, item, queuer) => void;
定义于: async-queuer.ts:175
任务成功时调用的可选回调。
any
TValue
AsyncQueuer<TValue>
void
optional started: boolean;
optional started: boolean;
定义于: async-queuer.ts:179
队列是否应立即开始处理任务。
optional throwOnError: boolean;
optional throwOnError: boolean;
定义于: async-queuer.ts:185
发生错误时是否抛出。如果未提供 onError 处理程序,则默认为 true;如果提供了 onError 处理程序,则默认为 false。可以显式设置以覆盖这些默认值。
optional wait: number | (queuer) => number;
optional wait: number | (queuer) => number;
定义于: async-queuer.ts:191
处理项目之间等待的毫秒数。可以是数字或返回数字的函数。
0
0
您的每周 JavaScript 资讯。每周一免费发送给超过 10 万开发者。