1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
class ProfileModal extends HTMLElement {
static observedAttributes = ["target-id"];
#attributes = [];
constructor() {
super();
this.#attributes.push({name: "target-id", value: this.getAttribute("target-id")});
const _session = session.get_sync();
const root = create_element("template", {}, [
create_element("h4", {innerText: _session.username, style: {margin: 0}}),
create_element("p", {innerText: _session.role}),
create_element("button", {innerText: "Log out", classList: ["do-logout"]}),
]);
this.style.padding = "5px";
this.innerHTML = root.innerHTML;
}
attributeChangedCallback(name, oldValue, newValue) {
}
}
customElements.define("profile-modal", ProfileModal, {extends: "dialog"});
class ElementBase extends HTMLElement {
constructor() {
super();
}
}
|