Files
ad/molodetz/static/js/components/Component.js
T

24 lines
481 B
JavaScript
Raw Normal View History

2026-10-05 09:36:20 +02:00
// retoor <retoor@molodetz.nl>
export class Component extends HTMLElement {
static tag = "";
static define() {
if (this.tag && !customElements.get(this.tag)) {
customElements.define(this.tag, this);
}
}
emit(name, detail = {}) {
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
}
connectedCallback() {
if (!this.dataset.ready) {
this.dataset.ready = "1";
this.setup();
}
}
setup() {}
}