Class BatchProcessor<ArgType, ReturnValueType>

Used for batching asynchronous requests together.

The supplied batcher function is used to send all the requests together in one go and return the response values.

const batcher = async (values: string[]): Promise<string[]> => makeMyNetworkRequest(values)
...
const processor = new BatchProcessor<string, string>({ batcher })
...
await Promise.all([
processor.invoke('foo'),
processor.invoke('bar'),
processor.invoke('today')
])

Type Parameters

  • ArgType
  • ReturnValueType

Constructors

Methods

Constructors

Methods