Defined in: batcher.ts:52
Options for configuring a Batcher instance
TValue
optional getShouldExecute?: (items, batcher) => boolean;Defined in: batcher.ts:57
Custom function to determine if a batch should be processed Return true to process the batch immediately
TValue[]
Batcher<TValue>
boolean
optional initialState?: Partial<BatcherState<TValue>>;Defined in: batcher.ts:61
Initial state for the batcher
optional key?: string;Defined in: batcher.ts:66
Optional key to identify this batcher instance. If provided, the batcher will be identified by this key in the devtools and PacerProvider if applicable.
optional maxSize?: number;Defined in: batcher.ts:71
Maximum number of items in a batch
Infinityoptional onExecute?: (batch, batcher) => void;Defined in: batcher.ts:75
Callback fired after a batch is processed
TValue[]
Batcher<TValue>
void
optional onItemsChange?: (batcher) => void;Defined in: batcher.ts:79
Callback fired after items are added to the batcher
Batcher<TValue>
void
optional started?: boolean;Defined in: batcher.ts:84
Whether the batcher should start processing immediately
trueoptional wait?: number | ((batcher) => number);Defined in: batcher.ts:91
Maximum time in milliseconds to wait before processing a batch. If the wait duration has elapsed, the batch will be processed. If not provided, the batch will not be triggered by a timeout.
Infinity