diff options
| author | Alexander Rolley <arolley35@gmail.com> | 2026-08-05 17:25:27 +0200 |
|---|---|---|
| committer | Alexander Rolley <arolley35@gmail.com> | 2026-08-05 17:25:27 +0200 |
| commit | dc90bc811648da695e4cb47826ea6479cfd22a06 (patch) | |
| tree | 3621725aadb61d267f1e88afb570a4ab3c824ab8 /src/z/z.js | |
| parent | 23ac91196552068d44bab5677a09a106b8172e27 (diff) | |
| parent | 9b63c0f568832085b75ea6e3e983dc6cbeccfea4 (diff) | |
Merge branch 'dev' of https://git.nathanreiner.xyz/memora into develop
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 { |