定义于: async-batcher.ts:82
用于配置 AsyncBatcher 实例的选项
• TValue
optional getShouldExecute: (items, batcher) => boolean;
optional getShouldExecute: (items, batcher) => boolean;
定义于: async-batcher.ts:87
自定义函数,用于确定是否应处理批次。返回 true 可立即处理批次。
TValue[]
AsyncBatcher<TValue>
boolean
optional initialState: Partial<AsyncBatcherState<TValue>>;
optional initialState: Partial<AsyncBatcherState<TValue>>;
定义于: async-batcher.ts:94
异步批处理器的初始状态
optional key: string;
optional key: string;
定义于: async-batcher.ts:99
可选的键,用于标识此异步批处理器实例。如果提供,异步批处理器将在开发者工具和 PacerProvider (如果适用) 中通过此键进行标识。
optional maxSize: number;
optional maxSize: number;
定义于: async-batcher.ts:104
批次中的最大项目数
Infinity
Infinity
optional onError: (error, batch, batcher) => void;
optional onError: (error, batch, batcher) => void;
定义于: async-batcher.ts:110
当批次函数抛出错误时,可选的错误处理程序。如果提供,处理程序将接收错误、失败的批次项目以及批处理器实例。这可以与 throwOnError 一起使用——处理程序将在任何错误抛出之前被调用。
unknown
TValue[]
AsyncBatcher<TValue>
void
optional onItemsChange: (batcher) => void;
optional onItemsChange: (batcher) => void;
定义于: async-batcher.ts:118
在项目添加到批处理器后触发的回调
AsyncBatcher<TValue>
void
optional onSettled: (batch, batcher) => void;
optional onSettled: (batch, batcher) => void;
定义于: async-batcher.ts:122
批次完成(成功或失败)后调用的可选回调
TValue[]
AsyncBatcher<TValue>
void
optional onSuccess: (result, batch, batcher) => void;
optional onSuccess: (result, batch, batcher) => void;
定义于: async-batcher.ts:126
批次成功时调用的可选回调
any
TValue[]
AsyncBatcher<TValue>
void
optional started: boolean;
optional started: boolean;
定义于: async-batcher.ts:135
批处理器是否应立即开始处理
true
true
optional throwOnError: boolean;
optional throwOnError: boolean;
定义于: async-batcher.ts:141
发生错误时是否抛出。如果未提供 onError 处理程序,则默认为 true;如果提供了 onError 处理程序,则默认为 false。可以显式设置以覆盖这些默认值。
optional wait: number | (asyncBatcher) => number;
optional wait: number | (asyncBatcher) => number;
定义于: async-batcher.ts:148
在处理批次之前等待的最大毫秒数。如果等待时间已过,则将处理批次。如果未提供,则不会通过超时触发批次。
Infinity
Infinity
您的每周 JavaScript 资讯。每周一免费发送给超过 10 万开发者。