UNPKG

rc-localforage

Version:

rc-localforage 是 localForage 在 React 的封装包,它提供了一种更符合 React 的使用风格(functional component style),同时保持了 localForage 的大部分功能

25 lines (19 loc) 618 B
import localforage from 'localforage'; export type LocalForageOptions = Parameters<(typeof localforage)['createInstance']>[0]; export type InitialValues = { [key: string]: any }; export interface LocalForageProviderProps { children: React.ReactNode; config?: LocalForageOptions; initialValues?: InitialValues; } export interface LocalForageContextProps { config: LocalForageOptions; initialValues: InitialValues; } export type ExtraOptions<T> = { // expire?: number; defaultValue?: T; target?: LocalForageOptions; errorSetHandler?: (err: any) => void; errorGetHandler?: (err: any) => void; };