aboutsummaryrefslogtreecommitdiff
path: root/src/z/z.js
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-07-30 07:46:37 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-07-30 07:46:37 +0200
commitc8744f9f6a28a23b83603435a3ad987f0d9f181b (patch)
treee0257c54661e9f34b6d2ce8658346f36aa0ff9e3 /src/z/z.js
parentd1776161dcc57b600ce7b18c5e7179757491fbc2 (diff)
temporal commit
Diffstat (limited to 'src/z/z.js')
-rw-r--r--src/z/z.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/z/z.js b/src/z/z.js
index ba07b9e..e279f42 100644
--- a/src/z/z.js
+++ b/src/z/z.js
@@ -1,10 +1,14 @@
class ZComponent extends HTMLElement {
+ static observedAttributes = [ 'type' ];
+
constructor() {
super();
this.attachShadow({ mode: 'open' });
+ this.onconnected = () => {};
+ this.ondisconnected = () => {};
}
- connectedCallback() {
+ build() {
const type = this.getAttribute('type');
if (type == null) {
@@ -22,6 +26,21 @@ class ZComponent extends HTMLElement {
Zenv.constructors[`component__${type}`](new Zenv(this));
}
+
+ attributeChangedCallback(name, previous, current) {
+ if (name == 'type') {
+ this.shadowRoot.innerHTML = '';
+ this.build()
+ }
+ }
+
+ connectedCallback() {
+ this.onconnected();
+ }
+
+ disconnectedCallback() {
+ this.ondisconnected();
+ }
}
class Zenv {