27 lines
485 B
JavaScript
27 lines
485 B
JavaScript
|
export default class MainMenu
|
||
|
{
|
||
|
constructor(id)
|
||
|
{
|
||
|
this.id = id;
|
||
|
this.menuGroups = [];
|
||
|
}
|
||
|
|
||
|
addMenuGroup(group)
|
||
|
{
|
||
|
this.menuGroups.push(group);
|
||
|
}
|
||
|
|
||
|
getElement()
|
||
|
{
|
||
|
let htmlElement = document.createElement('div');
|
||
|
htmlElement.id = this.id;
|
||
|
|
||
|
this.menuGroups.forEach(
|
||
|
(group) =>{
|
||
|
htmlElement.appendChild(group.getElement());
|
||
|
}
|
||
|
);
|
||
|
|
||
|
return htmlElement;
|
||
|
}
|
||
|
}
|