Fix two bugs in state.js

This commit is contained in:
Talia 2023-09-20 21:20:27 +02:00
parent f1d3eeb9a2
commit f13bccf7a9
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -6,7 +6,7 @@ export class ChangeEvent extends Event {
} }
get final() { get final() {
if (!this.#final) { if (!this.#final) {
this.#final = new Map(changes) this.#final = new Map(this.changes)
} }
return this.#final return this.#final
} }
@ -115,8 +115,8 @@ export class StoredState extends State {
// Initialise storage from defaults // Initialise storage from defaults
for (let [prop, value] of Object.entries(init)) { for (let [prop, value] of Object.entries(init)) {
if (prop === this.#valueKey) prop = 'value' if (prop === 'value') prop = this.#valueKey
if (this.#storage[prop] == undefined) if (this.#storage[prop] === undefined)
this.set(prop, value) this.set(prop, value)
} }