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

List of constructors for this class
Constructor Modifiers Description
(constructor)(process, maxBatchSize) Creates an instance of BatchManager.

Methods

List of methods on this class
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

List of 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

List of 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