UNPKG

@epic-web/cachified

Version:
20 lines (19 loc) 846 B
import type { GetFreshValue, GetFreshValueContext } from './common'; type OnValueCallback<Value> = (context: GetFreshValueContext & { value: Value; }) => void; export type AddFn<Value, Param> = (param: Param, onValue?: OnValueCallback<Value>) => GetFreshValue<Value>; export declare function createBatch<Value, Param>(getFreshValues: (params: Param[]) => Value[] | Promise<Value[]>, autoSubmit: false): { submit: () => Promise<void>; add: AddFn<Value, Param>; }; export declare function createBatch<Value, Param>(getFreshValues: (params: Param[]) => Value[] | Promise<Value[]>): { add: AddFn<Value, Param>; }; export declare class Deferred<Value> { readonly promise: Promise<Value>; readonly resolve: (value: Value | Promise<Value>) => void; readonly reject: (reason: unknown) => void; constructor(); } export {};