UNPKG

batchloader

Version:

BatchLoader is a utility for data fetching layer to reduce requests via batching written in TypeScript. Inspired by Facebook's DataLoader

8 lines 595 B
import { BatchLoader, KeyToUniqueId } from './batchloader'; import { IBatchLoader, MaybePromise } from './types'; export interface IBatchCache<Key, Value> { mget: (keys: Key[]) => MaybePromise<Array<Value | undefined>>; mset: (keyValues: Array<[Key, Value]>) => MaybePromise<void>; } export declare const proxyLoaderWithCache: <Key, Value>(cache: IBatchCache<Key, Value>, loader: IBatchLoader<Key, Value>, keyToUniqueId: KeyToUniqueId<Key> | null, batchDelay?: number | undefined, batchSize?: number | undefined) => BatchLoader<Key, Value>; //# sourceMappingURL=cacheproxyloader.d.ts.map