diff --git a/.gitignore b/.gitignore index 74fd6a4..ce86f57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ frontend/dist/*.js frontend/.js -underbbs \ No newline at end of file +underbbs +__debug_* \ No newline at end of file diff --git a/frontend/ts/settings-element.ts b/frontend/ts/settings-element.ts index bfd4f9d..b30de5a 100644 --- a/frontend/ts/settings-element.ts +++ b/frontend/ts/settings-element.ts @@ -13,15 +13,14 @@ export class SettingsElement extends HTMLElement { } connectedCallback() { - this.attributeChangedCallback(); } - attributeChangedCallback() { - const adapters = this.getAttribute("data-adapters"); - if (adapters) { - this._adapters = this.getAttribute("data-adapters")?.split(",") ?? []; - } else { - this._adapters = []; + attributeChangedCallback(attr: string, prev: string, next: string) { + switch (attr) { + case "data-adapters": + if (next) { + this._adapters = next.split(","); + } } this.showSettings(this)(); } diff --git a/frontend/ts/tabbar-element.ts b/frontend/ts/tabbar-element.ts index 3b86342..0d50ccc 100644 --- a/frontend/ts/tabbar-element.ts +++ b/frontend/ts/tabbar-element.ts @@ -4,7 +4,7 @@ import {Settings} from "./settings" export class TabBarElement extends HTMLElement { static observedAttributes = [ "data-adapters", "data-currentadapter" ] - private _adapters: string[] | null = null; + private _adapters: string[] = []; private _currentAdapter: string | null = null; constructor() { @@ -12,8 +12,6 @@ export class TabBarElement extends HTMLElement { } connectedCallback() { - this.attributeChangedCallback(); - if (this._currentAdapter) { this.showAdapterFunc(this, this._currentAdapter)(); } else { @@ -21,18 +19,21 @@ export class TabBarElement extends HTMLElement { } } - attributeChangedCallback() { - let html = "