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 08:10:47 +0200
commit4d064042e8a6ebf874fecbc23f13073f39fa1ebe (patch)
tree55cb0fc9d92dd2edd998bb910985de5e3b9ed012 /src/z/z.js
parentd1776161dcc57b600ce7b18c5e7179757491fbc2 (diff)
first version of js parser
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 {