Skip to content

Commit

Permalink
Fix bug on loading
Browse files Browse the repository at this point in the history
fixes #2
  • Loading branch information
treeder authored Nov 16, 2023
1 parent c6817f2 commit 947f37d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions state.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ export class State extends EventTarget { // implements EventTarget (partially an

// the alternative way using individual keys
for (let key in localStorage) {
let value = localStorage.getItem(key)
value = JSON.parse(value)
this.stateMap.set(key, value)
if (key.startsWith(State.statePrefix)) {
let value = localStorage.getItem(key)
value = JSON.parse(value)
this.stateMap.set(key, value)
}
}
return state
}
Expand All @@ -70,7 +72,7 @@ export class State extends EventTarget { // implements EventTarget (partially an
value,
},
}))
return m // can chain calls together
return m
}

delete(key) {
Expand Down

0 comments on commit 947f37d

Please sign in to comment.