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:
19
js/trdom_menubar.js
Normal file
19
js/trdom_menubar.js
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user