Refactors event system to use CoreEvents

Migrates the application to use a new CoreEvents system.

This change removes the legacy EventTypes constant file and updates all managers, renderers, and core components to use the CoreEvents constant file for event emission and subscription.

This improves code maintainability and promotes a consistent eventing strategy across the application. Adds validation to EventBus emit and extractCategory functions.
This commit is contained in:
Janus Knudsen 2025-08-20 20:22:51 +02:00
parent 414ef1caaf
commit 4b4dbdc0d6
11 changed files with 76 additions and 228 deletions

View file

@ -1,5 +1,5 @@
import { IEventBus } from '../types/CalendarTypes';
import { EventTypes } from '../constants/EventTypes';
import { CoreEvents } from '../constants/CoreEvents';
import { CalendarConfig } from '../core/CalendarConfig';
import { DateCalculator } from '../utils/DateCalculator';
import { EventRenderingService } from './EventRendererManager';
@ -26,7 +26,7 @@ export class NavigationRenderer {
* Setup event listeners for DOM updates
*/
private setupEventListeners(): void {
this.eventBus.on(EventTypes.WEEK_INFO_UPDATED, (event: Event) => {
this.eventBus.on(CoreEvents.WEEK_INFO_UPDATED, (event: Event) => {
const customEvent = event as CustomEvent;
const { weekNumber, dateRange } = customEvent.detail;
this.updateWeekInfoInDOM(weekNumber, dateRange);