class Renderer { constructor() { this.rendererFuncs = { "UITab": [], "Menu": [], "GameField": [], "Settings": [] }; } addRenderFunc(type, func) { this.rendererFuncs[type].push(func); } renderMenu() { const menuContainer = document.querySelector("#ui .main-menu"); const menuList = menuContainer.querySelector(".menu-list ul"); menuList.innerHTML = ""; for(let item of this.rendererFuncs.Menu) { const renderedItemData = item(); let li = document.createElement("li"); li.classList.add("menu-list-item"); li.appendChild(renderedItemData.btn); menuList.appendChild(li); } } render() { } }