mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-25 09:49:36 +01:00
14 lines
452 B
JavaScript
14 lines
452 B
JavaScript
|
import { el, on } from "deka-dom-el";
|
||
|
const log= mark=> console.log.bind(console, mark);
|
||
|
|
||
|
const abort_controller= new AbortController();
|
||
|
const { signal }= abort_controller;
|
||
|
|
||
|
const button= el("button", "Test click");
|
||
|
button.addEventListener("click", log("`addEventListener`"), { signal });
|
||
|
on("click", log("`on`"), { signal })(button);
|
||
|
|
||
|
document.body.append(
|
||
|
button, " ", el("button", { textContent: "Off", onclick: ()=> abort_controller.abort() })
|
||
|
);
|