Type Alias BatchConstructor<TFn>

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

Options to construct a batch function

Type Parameters

  • TFn extends (...args: any[]) => any

Type declaration

  • batch: (args: Parameters<TFn>[]) => Parameters<TFn>

    Function to batch the inputs across multiple calls

  • OptionaldisregardExecutionTime?: boolean

    See debounce for more information

  • fn: TFn

    Function to be wrapped

  • interval: number

    Interval between each batched call

  • Optionalunbatch?: (inputs: Parameters<TFn>[], output: AwaitRet<TFn>) => AwaitRet<TFn>[]

    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