1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-23 00:59:38 +01:00
deka-dom-el/docs_src/components/examples/scopes/cleaning.js

19 lines
463 B
JavaScript
Raw Normal View History

2024-05-17 22:25:10 +02:00
import { el, empty, on } from "deka-dom-el";
2023-12-04 18:19:30 +01:00
document.body.append(
el(component),
el("button", {
textContent: "Remove",
onclick: ()=> empty(document.body),
type: "button"
})
);
import { S } from "deka-dom-el/signals";
2023-12-04 18:19:30 +01:00
function component(){
const textContent= S("Click to change text.");
2023-12-04 18:19:30 +01:00
const onclickChange= on("click", function redispatch(){
textContent("Text changed! "+(new Date()).toString())
});
return el("p", textContent, onclickChange);
}