61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
|
|
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;
|