22 lines
455 B
JavaScript
22 lines
455 B
JavaScript
export default class MainMenuEntry
|
|
{
|
|
constructor(title, event)
|
|
{
|
|
this.title = title;
|
|
this.event = event;
|
|
}
|
|
|
|
getElement()
|
|
{
|
|
let htmlElement = document.createElement('li');
|
|
htmlElement.innerText = this.title;
|
|
htmlElement.addEventListener(
|
|
'click',
|
|
() => {
|
|
window.dispatchEvent(new this.event());
|
|
}
|
|
);
|
|
|
|
return htmlElement;
|
|
}
|
|
} |