Skip to content

Commit

Permalink
meh
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Dec 14, 2024
1 parent 1892421 commit ef8dad5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ export class PersistedState<T> {
$effect(() => {
if (!syncTabs || storageType !== "local") return;

return addEventListener(window, "storage", this.#handleStorageEvent.bind(this));
return addEventListener(window, "storage", this.#handleStorageEvent);
});
});
});
}

#handleStorageEvent(event: StorageEvent): void {
#handleStorageEvent = (event: StorageEvent): void => {
if (event.key !== this.#key || !this.#storage) return;

const valueFromStorage = getValueFromStorage({
Expand All @@ -152,7 +152,7 @@ export class PersistedState<T> {
if (valueFromStorage.found) {
this.#current = valueFromStorage.value;
}
}
};

get current(): T {
this.#subscribe();
Expand Down

0 comments on commit ef8dad5

Please sign in to comment.