框架
版本
Debouncer API 参考
Throttler API 参考
速率限制器 API 参考
队列 API 参考
批处理器 API 参考
批处理器示例

BatcherOptions

接口:BatcherOptions<TValue>

定义于:batcher.ts:6

用于配置 Batcher 实例的选项

类型参数

TValue

属性

getShouldExecute?

ts
optional getShouldExecute: (items, batcher) => boolean;
optional getShouldExecute: (items, batcher) => boolean;

定义于:batcher.ts:11

用于确定是否应处理批处理的自定义函数 返回 true 以立即处理批处理

参数

items

TValue[]

batcher

Batcher<TValue>

返回

boolean


maxSize?

ts
optional maxSize: number;
optional maxSize: number;

定义于:batcher.ts:16

批处理中的最大项目数

默认值

ts
Infinity
Infinity

onExecute?

ts
optional onExecute: (batcher) => void;
optional onExecute: (batcher) => void;

定义于:batcher.ts:20

处理批处理后触发的回调

参数

batcher

Batcher<TValue>

返回

void


onIsRunningChange?

ts
optional onIsRunningChange: (batcher) => void;
optional onIsRunningChange: (batcher) => void;

定义于:batcher.ts:24

批处理器运行状态更改时触发的回调

参数

batcher

Batcher<TValue>

返回

void


onItemsChange?

ts
optional onItemsChange: (batcher) => void;
optional onItemsChange: (batcher) => void;

定义于:batcher.ts:28

将项目添加到批处理器后触发的回调

参数

batcher

Batcher<TValue>

返回

void


started?

ts
optional started: boolean;
optional started: boolean;

定义于:batcher.ts:33

批处理器是否应立即开始处理

默认值

ts
true
true

wait?

ts
optional wait: number;
optional wait: number;

定义于:batcher.ts:40

处理批处理前等待的最长时间(���毫秒为单位)。 如果等待持续时间已过,则将处理该批处理。 如果未提供,则批处理不会因超时而触发。

默认值

ts
Infinity
Infinity