Loading of levels is working now

This commit is contained in:
Mal
2023-09-18 22:33:55 +02:00
parent 349792f916
commit aeece9731c
11 changed files with 347 additions and 271 deletions

25
js/events/EventBus.js Normal file
View File

@@ -0,0 +1,25 @@
export class EventBus
{
static listeners = []
static addEventListener(eventName, callback)
{
EventBus.listeners.push({eventName, callback});
window.addEventListener(eventName, callback, false);
}
static dispatchEvent(event)
{
window.dispatchEvent(event);
}
static clear()
{
for (const listener of EventBus.listeners) {
window.removeEventListener(listener.eventName, listener.callback, false);
}
EventBus.listeners = [];
}
}