BatchManager Class
Packages > @fluidframework/common-utils > BatchManager
Manages a queue of work to be batch processed at next javascript turn of execution
Signature:
export declare class BatchManager<T>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(process, maxBatchSize) | Creates an instance of BatchManager. |
Methods
Method | Modifiers | Description |
---|---|---|
add(id, work) | Queue up a work item to be processed | |
drain() | Process all the pending work item synchronously now |
Constructors
BatchManager.(constructor)
Creates an instance of BatchManager.
Signature:
constructor(process: (id: string, work: T[]) => void, maxBatchSize?: number);
Parameters
Parameter | Type | Description |
---|---|---|
process | (id: string, work: T[]) => void | callback to process the work |
maxBatchSize | number |
Methods
add
Queue up a work item to be processed
Signature:
add(id: string, work: T): void;
Parameters
Parameter | Type | Description |
---|---|---|
id | string | id of the batch to add the work item to |
work | T | the work item to be added |
Returns:
void
drain
Process all the pending work item synchronously now
Signature:
drain(): void;
Returns:
void