Calendar/wwwroot/js/core/EventBus.d.ts

61 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-02-03 00:02:25 +01:00
import { IEventLogEntry, IEventBus } from '../types/CalendarTypes';
/**
* Central event dispatcher for calendar using DOM CustomEvents
* Provides logging and debugging capabilities
*/
export declare class EventBus implements IEventBus {
private eventLog;
private debug;
private listeners;
private logConfig;
/**
* Subscribe to an event via DOM addEventListener
*/
on(eventType: string, handler: EventListener, options?: AddEventListenerOptions): () => void;
/**
* Subscribe to an event once
*/
once(eventType: string, handler: EventListener): () => void;
/**
* Unsubscribe from an event
*/
off(eventType: string, handler: EventListener): void;
/**
* Emit an event via DOM CustomEvent
*/
emit(eventType: string, detail?: unknown): boolean;
/**
* Log event with console grouping
*/
private logEventWithGrouping;
/**
* Extract category from event type
*/
private extractCategory;
/**
* Get styling for different categories
*/
private getCategoryStyle;
/**
* Configure logging for specific categories
*/
setLogConfig(config: {
[key: string]: boolean;
}): void;
/**
* Get current log configuration
*/
getLogConfig(): {
[key: string]: boolean;
};
/**
* Get event history
*/
getEventLog(eventType?: string): IEventLogEntry[];
/**
* Enable/disable debug mode
*/
setDebug(enabled: boolean): void;
}
export declare const eventBus: EventBus;