createBatcher
createBatcher<
I,R>(options):Batcher<I,R>
Defined in: src/batcher.ts:43
DataLoader / bottleneck-Batcher style batching:
const users = createBatcher({ maxSize: 100, maxWait: '5ms', key: (id) => id, run: (ids, { signal }) => db.usersByIds(ids, { signal }) });const [a, b] = await Promise.all([users.load('1'), users.load('2')]); // one queryType Parameters
Section titled “Type Parameters”I
R
Parameters
Section titled “Parameters”options
Section titled “options”BatcherOptions<I, R>
Returns
Section titled “Returns”Batcher<I, R>