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.
batcher
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')]) Copy
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')])
Construct a new batch processor that's used for batching requests together.
Asynchronously invoke an operation with some arguments and return a promise with the resolved data.
The invocation arguments.
The invoked response.
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.