Interface BatchConstructor<TFn>

Source
Expand description

Options to construct a batch function

interface BatchConstructor<TFn extends AnyFn> {
    batch: (args: Parameters<TFn>[]) => Parameters<TFn>;
    disregardExecutionTime?: boolean;
    fn: TFn;
    interval: number;
    unbatch?: (
        inputs: Parameters<TFn>[],
        output: AwaitRet<TFn>,
    ) => AwaitRet<TFn>[];
}

Properties§

§batch: { ... }

Function to batch the inputs across multiple calls

§disregardExecutionTime?: boolean

Same as that for DebounceConstructor

§fn: TFn

Function to be wrapped

§interval: number

Interval between each batched call

§unbatch?: { ... }

If provided, unbatch the output according to the inputs, so each call receives its own output.

By default, each input will receive the same output from the batched call