an_xiao/police_uniapp/node_modules/vuex-persistedstate/dist/index.d.ts

24 lines
931 B
TypeScript
Raw Normal View History

2024-07-25 16:03:08 +08:00
import { Store, MutationPayload } from "vuex";
interface Storage {
getItem: (key: string) => any;
setItem: (key: string, value: any) => void;
removeItem: (key: string) => void;
}
interface Options<State> {
key?: string;
paths?: string[];
reducer?: (state: State, paths: string[]) => object;
subscriber?: (store: Store<State>) => (handler: (mutation: any, state: State) => void) => void;
storage?: Storage;
getState?: (key: string, storage: Storage) => any;
setState?: (key: string, state: any, storage: Storage) => void;
filter?: (mutation: MutationPayload) => boolean;
arrayMerger?: (state: any[], saved: any[]) => any;
rehydrated?: (store: Store<State>) => void;
fetchBeforeUse?: boolean;
overwrite?: boolean;
assertStorage?: (storage: Storage) => void | Error;
}
export default function <State>(options?: Options<State>): (store: Store<State>) => void;
export {};