diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-07-30 07:46:37 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-07-30 08:10:47 +0200 |
| commit | 4d064042e8a6ebf874fecbc23f13073f39fa1ebe (patch) | |
| tree | 55cb0fc9d92dd2edd998bb910985de5e3b9ed012 /src/z/z.js | |
| parent | d1776161dcc57b600ce7b18c5e7179757491fbc2 (diff) | |
first version of js parser
Diffstat (limited to 'src/z/z.js')
| -rw-r--r-- | src/z/z.js | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -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 { |