Skip to content

Commit

Permalink
fix emit not trigger in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcwoshizz committed Mar 16, 2023
1 parent 49e67aa commit 433d9a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-poets-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zcloak/ui-store": patch
---

fix emit not trigger in browser
2 changes: 1 addition & 1 deletion packages/ui-store/src/BrowserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class BrowserSession extends BaseStore {
constructor() {
super();
this.#session = new SessionStorage();
this.#session.on('store_changed', this.emit);
this.#session.on('store_changed', (event, ...args) => this.emit(event, ...args));
}

public async all(): Promise<[string, unknown][]> {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-store/src/BrowserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class BrowserStore extends BaseStore {
constructor() {
super();
this.#store = new LocalStorage();
this.#store.on('store_changed', this.emit);
this.#store.on('store_changed', (event, ...args) => this.emit(event, ...args));
}

public async all(): Promise<[string, unknown][]> {
Expand Down

0 comments on commit 433d9a7

Please sign in to comment.