1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-12-15 05:43:45 +01:00

Add signals functionality and reactive attributes in assign

This commit is contained in:
2023-08-24 14:15:55 +02:00
parent 7a2c3e6a4b
commit 404971f484
6 changed files with 88 additions and 36 deletions

View File

@@ -97,15 +97,13 @@ document.body.append(
);
```
## Events and dynamic parts
## Events and signals for reactivity
*investigation*:
```js
const output_dynamic= eventsSink(store=> ({
element,
onchange: listen("change", event=> assign(store.element, { textContent: event.target.value }))
}));
const value= S("");
document.body.append(
el("span", { style: { fontWeight: "bold" }, textContent: "" }, output_dynamic.target),
el("input", { type: "text" }, output_dynamic.onchange)
el("span", { style: { fontWeight: "bold" }, textContent: ()=> S(value) }),
el("input", { type: "text" },
listen("change", event=> S(value, event.target, value)))
);
```