Modularize code

Split JS into per-class files
Cut parts of trweb class out
Move init code from event handler to constructor
This commit is contained in:
2025-10-08 14:30:54 +02:00
parent 7877d657fc
commit 9d13a71dc1
4 changed files with 112 additions and 50 deletions

19
js/trdom_menubar.js Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
class trdom_menubar {
#element = document.createElement('div');
getElement() {
return this.#element;
}
#menuNodes = {};
addMenuNode(name, element, after = null) {
//TODO: add ID checks and after support
this.#menuNodes[name] = element;
this.#element.appendChild(element);
}
constructor () {
this.#element.classList.add('trweb_header');
}
}