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

♻️ use eventsSink for n-binding

This commit is contained in:
2023-08-23 20:15:30 +02:00
parent 31563c4f7b
commit 7a2c3e6a4b
2 changed files with 27 additions and 29 deletions

View File

@@ -98,16 +98,14 @@ document.body.append(
```
## Events and dynamic parts
*investigation*:
```js
const output_dynamic= (function(){
const element= el("span", { style: { fontWeight: "bold" }, textContent: "" });
return {
element,
onchange: listen("change", event=> assign(element, { textContent: event.target.value }))
};
})();
const output_dynamic= eventsSink(store=> ({
element,
onchange: listen("change", event=> assign(store.element, { textContent: event.target.value }))
}));
document.body.append(
output_dynamic.element,
el("span", { style: { fontWeight: "bold" }, textContent: "" }, output_dynamic.target),
el("input", { type: "text" }, output_dynamic.onchange)
);
```