mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-24 17:39:36 +01:00
20 lines
497 B
JavaScript
20 lines
497 B
JavaScript
|
import { el, empty } from "deka-dom-el";
|
||
|
document.body.append(
|
||
|
el(component),
|
||
|
el("button", {
|
||
|
textContent: "Remove",
|
||
|
onclick: ()=> empty(document.body),
|
||
|
type: "button"
|
||
|
})
|
||
|
);
|
||
|
import { on } from "deka-dom-el";
|
||
|
import { O } from "deka-dom-el/observables";
|
||
|
function component(){
|
||
|
const textContent= O("Click to change text.");
|
||
|
|
||
|
const onclickChange= on("click", function redispatch(){
|
||
|
textContent("Text changed! "+(new Date()).toString())
|
||
|
});
|
||
|
return el("p", textContent, onclickChange);
|
||
|
}
|