UNPKG

react-terminal-viewer

Version:

<h1 align="center"> react-terminal-viewer </h1>

31 lines (30 loc) 1.27 kB
/// <reference types="react" /> import { ICacheOptions } from './useCache'; export interface IRemoteOptions { fetch?: (cacheValueKey?: string | number) => Promise<FetchResult>; cacheKey?: string | number; cacheValueKey?: string | number; timeout?: number; retry?: number; enableBatch?: boolean; } export declare type UseRemoteHooks = (defaultData: string, callback?: (string: string) => void, options?: IRemoteOptions | undefined, cacheOptions?: ICacheOptions) => { data: string; refresh: () => void; cacheStore: LocalForage; loading: boolean; }; export interface FetchResult { result: string; next: (() => Promise<FetchResult>) | undefined; key?: string | number; nextKey?: string | number; } export declare const useSequenceFetch: (fetch: ((cacheValueKey?: string | number) => Promise<FetchResult>) | undefined, callback: (data: string) => Promise<void>, options: Pick<IRemoteOptions, 'timeout' | 'retry' | 'cacheKey' | 'cacheValueKey'>, cacheOptions?: ICacheOptions) => { loading: boolean; setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>; refresh: () => Promise<void>; cacheStore: LocalForage; }; declare const useRemote: UseRemoteHooks; export default useRemote;