import * as react from 'react'; type ReadonlyNonBasic = T extends object ? Readonly : T; /** the create one options */ type CreateOptions$1 = { /** useEffect or useLayoutEffect */ useEffect: boolean; /** state name */ name?: string; }; type EventHandler = (...args: any[]) => void; declare class EventBus { private E; on(event: string, handler: EventHandler): void; off(event: string, handler?: EventHandler): void; emit(event: string, ...args: any[]): void; } interface Cache { setItem: (key: string, state: string) => Promise | void; getItem: (key: string) => Promise | string | null; removeItem: (key: string) => Promise | void; } declare function debounce(cb: T, wait?: number): T; declare function onPersistReady(fn: () => void): void; declare function emitPersistReady(): void; interface CreateOptions { /** debounce ms, default 100ms */ debounce: number; /** update value from storage if have */ cache: Cache; } interface Options { /** storage key */ key: string; /** update the state from cache */ setState: (state: T) => void; /** get state save to cache */ getState: () => T; encode?: (state: T) => string; decode?: (data: string) => T; } declare function createPersist(options: CreateOptions): ({ key, setState, getState, ...rest }: Options) => readonly [boolean, () => void | Promise, number]; declare function Provider({ children }: { children?: React.ReactNode; }): react.ReactNode; export { type Cache as C, EventBus as E, type Options as O, Provider as P, type ReadonlyNonBasic as R, type CreateOptions$1 as a, createPersist as c, debounce as d, emitPersistReady as e, onPersistReady as o };