function batch<TValue>(fn, options): (item) => void
function batch<TValue>(fn, options): (item) => void
Defined in: batcher.ts:247
Creates a batcher that processes items in batches
• TValue
(items) => void
BatcherOptions<TValue>
Function
Adds an item to the batcher If the batch size is reached, timeout occurs, or shouldProcess returns true, the batch will be processed
TValue
void
const batchItems = batch<number>({
batchSize: 3,
processBatch: (items) => console.log('Processing:', items)
});
batchItems(1);
batchItems(2);
batchItems(3); // Triggers batch processing
const batchItems = batch<number>({
batchSize: 3,
processBatch: (items) => console.log('Processing:', items)
});
batchItems(1);
batchItems(2);
batchItems(3); // Triggers batch processing
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.