Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setItem mutation param #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ In strict mode, we cannot use `store.replaceState` so instead we use a mutation
You'll need to keep in mind to add the **`RESTORE_MUTATION`** to your mutations
See example below

To configure with strict mode support -
To configure with strict mode support -

```typescript
import Vue from 'vue'
Expand Down Expand Up @@ -237,7 +237,7 @@ interface Storage {
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, data: string): void;
setItem(key: string, data: string, mutation: string): void;
[key: string]: any;
[index: number]: string;
}
Expand All @@ -251,7 +251,7 @@ Now note the representative interface of Local Forage -
```typescript
export interface LocalForage {
getItem<T>(key: string): Promise<T>
setItem<T>(key: string, data: T): Promise<T>
setItem<T>(key: string, data: T, mutation: string): Promise<T>
removeItem(key: string): Promise<void>
clear(): Promise<void>
length(): Promise<number>
Expand Down
2 changes: 1 addition & 1 deletion dist/AsyncStorage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface AsyncStorage {
name: string;
};
getItem<T>(key: string): Promise<T>;
setItem<T>(key: string, data: T): Promise<T>;
setItem<T>(key: string, data: T, mutation: string): Promise<T>;
removeItem(key: string): Promise<void>;
clear(): Promise<void>;
length(): Promise<number>;
Expand Down
2 changes: 1 addition & 1 deletion dist/MockStorage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class MockStorage implements Storage {
[key: string]: any;
readonly length: number;
key(index: number): string | any;
setItem(key: string, data: any): void;
setItem(key: string, data: any, mutation?: string): void;
getItem(key: string): string;
removeItem(key: string): void;
clear(): void;
Expand Down
3 changes: 2 additions & 1 deletion dist/PersistOptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export interface PersistOptions<S> {
* @param key
* @param state
* @param [storage]
* @param [mutation]
*/
saveState?: (key: string, state: {}, storage?: Storage) => Promise<void> | void;
saveState?: (key: string, state: {}, storage?: Storage, mutation?: string) => Promise<void> | void;
/**
* Function to reduce state to the object you want to save.
* Be default, we save the entire state.
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export declare class VuexPersistence<S, P extends Payload> implements PersistOpt
asyncStorage: boolean;
storage: Storage | AsyncStorage;
restoreState: (key: string, storage?: AsyncStorage | Storage) => Promise<S> | S;
saveState: (key: string, state: {}, storage?: AsyncStorage | Storage) => Promise<void> | void;
saveState: (key: string, state: {}, storage?: AsyncStorage | Storage, mutation?: string) => Promise<void> | void;
reducer: (state: S) => {};
key: string;
filter: (mutation: Payload) => boolean;
Expand Down
24 changes: 12 additions & 12 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading