Skip to content

Commit

Permalink
feat: extension store use the async callback (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: alpers <[email protected]>
  • Loading branch information
linhan and linhan-work authored Jan 10, 2023
1 parent 80d9fee commit d4978c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions packages/ui-store/src/ExtensionSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ export class ExtensionSession extends BaseStore {
}

public remove(key: string, fn?: () => void) {
session.remove(key);
fn && fn();
session.remove(key, fn);
}

public set(key: string, value: unknown, fn?: () => void) {
session.set({ [key]: value });
fn && fn();
session.set({ [key]: value }, fn);
}
}
6 changes: 2 additions & 4 deletions packages/ui-store/src/ExtensionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ export class ExtensionStore extends BaseStore {
}

public remove(key: string, fn?: () => void) {
storage.remove(key);
fn && fn();
storage.remove(key, fn);
}

public set(key: string, value: unknown, fn?: () => void) {
storage.set({ [key]: value });
fn && fn();
storage.set({ [key]: value }, fn);
}
}

0 comments on commit d4978c5

Please sign in to comment.