24 lines
481 B
JavaScript
24 lines
481 B
JavaScript
// 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() {}
|
|
}
|