mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Main menu and save function to json file implemented.
This commit is contained in:
22
tilorswift/js/menu/MainMenuEntry.js
Normal file
22
tilorswift/js/menu/MainMenuEntry.js
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user