Map names of forward states to "value"

This commit is contained in:
Talia 2023-12-27 18:49:10 +01:00
parent 64b73676cb
commit 7febebce65
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -128,9 +128,11 @@ export class ForwardState extends EventTarget {
backend.addEventListener("change", event => {
const state = ref.deref()
if (state) {
const relevantChanges = event.changes.filter(([name]) => name === property)
const relevantChanges = event.changes
.filter(([name]) => name === property)
.map(([_, value]) => ["value", value])
if (relevantChanges.length > 0)
state.dispatchEvent(new ChangeEvent(relevantChanges))
state.dispatchEvent(new ChangeEvent(...relevantChanges))
} else {
abortController.abort()
}