UNPKG

1.81 kBTypeScriptView Raw
1/**
2 * Created by championswimmer on 18/07/17.
3 */
4import { Mutation, Payload, Plugin } from 'vuex';
5import { AsyncStorage } from './AsyncStorage';
6import { MockStorage } from './MockStorage';
7import { PersistOptions } from './PersistOptions';
8import { MergeOptionType } from './utils';
9/**
10 * A class that implements the vuex persistence.
11 * @type S type of the 'state' inside the store (default: any)
12 */
13export declare class VuexPersistence<S> implements PersistOptions<S> {
14 asyncStorage: boolean;
15 storage: Storage | AsyncStorage | undefined;
16 restoreState: (key: string, storage?: AsyncStorage | Storage) => Promise<S> | S;
17 saveState: (key: string, state: {}, storage?: AsyncStorage | Storage) => Promise<void> | void;
18 reducer: (state: S) => Partial<S>;
19 key: string;
20 filter: (mutation: Payload) => boolean;
21 modules: string[];
22 strictMode: boolean;
23 supportCircular: boolean;
24 mergeOption: MergeOptionType;
25 /**
26 * The plugin function that can be used inside a vuex store.
27 */
28 plugin: Plugin<S>;
29 /**
30 * A mutation that can be used to restore state
31 * Helpful if we are running in strict mode
32 */
33 RESTORE_MUTATION: Mutation<S>;
34 subscribed: boolean;
35 private _mutex;
36 /**
37 * Create a {@link VuexPersistence} object.
38 * Use the <code>plugin</code> function of this class as a
39 * Vuex plugin.
40 * @param {PersistOptions} options
41 */
42 constructor(options?: PersistOptions<S>);
43 /**
44 * Creates a subscriber on the store. automatically is used
45 * when this is used a vuex plugin. Not for manual usage.
46 * @param store
47 */
48 private subscriber;
49}
50export { MockStorage, AsyncStorage, PersistOptions };
51export default VuexPersistence;