import { AsyncReturnType } from './promises'; import { ExtensibleFunction } from './extensibleFunction'; type EFFunc = (...[]: Iterable) => any; type LoadState = 'unloaded' | 'loading' | 'loaded' | 'error'; interface EnsureFuncOptions { initialValue?: AsyncReturnType; initialState: LoadState; fetchOnAccess: boolean; } /** * A Class for helping with fetching remote data and tracking status. * When the object is called (either directly or via .ensure()), it executes the function that was given during construction, and return a Promise. * * `state` is transitioned to 'loading' until the function returns, whereon `state` is transitioned to 'loaded' or 'error'. */ export declare class EnsureFunction extends ExtensibleFunction, Promise>> { constructor(func: F); constructor(options: Partial>, func: F); private options; private func; currentPromise: Promise>; accessor _value: AsyncReturnType; accessor error: any; accessor state: LoadState; _call(args: Parameters): Promise; get value(): AsyncReturnType; markLoaded(): void; setValue(value: AsyncReturnType): void; ensure(...args: Parameters): Promise; reload(...args: Parameters): Promise; reset(keepValue?: boolean): void; } export {};