/** * Enhanced event emitter with language change helpers * filepath: /home/janrau/tm-integration/packages/core/src/base/event-emitter.ts */ import type { LionRapidEventEnvelope, LionRapidEventPayloads } from '../types/lionRapid.types.js'; import type { TranslationRequest } from '../types/translation.types.js'; type EventListener, K extends keyof T> = (envelope: LionRapidEventEnvelope) => void; export declare class EventEmitter { private eventListeners; private debugMode; /** * Subscribe to events (PUBLIC API) - Fully type-safe */ on(event: K, listener: EventListener): void; /** * Unsubscribe from events (PUBLIC API) - Fully type-safe */ off(event: K, listener: EventListener): void; /** * ✅ Type-safe emit with proper generic constraint */ emit(event: K, envelope: LionRapidEventEnvelope): void; hasListeners(event: K): boolean; clearEvents(): void; /** * ✅ Create base context once per request */ private createContext; /** * ✅ Type-safe event emission helper */ private emitEvent; /** * ✅ Translation event builder with proper typing */ translation(request: TranslationRequest, handler?: string): { request: () => void; success: (value: string) => void; fallback: (value: string) => void; missing: (fallbackValue: string, locale: string, namespace: string) => void; notFound: (fallbackValue: string, locale: string, namespace: string) => void; locked: (fallbackValue: string, locale: string, namespace: string) => void; }; /** * ✅ Repository event builder with better typing */ repo(request: TranslationRequest | string, source: string): { getStart: () => void; getSuccess: (value: string) => void; getMiss: () => void; setStart: (value: string) => void; setSuccess: (value: string) => void; error: (error: Error) => void; }; /** * ✅ Network event builder */ network(request: TranslationRequest | string, method?: string): { start: () => void; success: (value: string) => void; error: (error: unknown, status?: number) => void; retry: (attempt: number, delayMs: number, reason?: string) => void; }; /** * ✅ Builder event builder */ builder(): { use: (type: "plugin" | "sync" | "async" | "network") => void; buildStart: (locale: string, namespace: string) => void; buildDone: (repositories: string[], plugins: string[]) => void; }; /** * ✅ Language change event builder */ language(oldLocale: string, newLocale: string): { start: () => void; complete: () => void; error: (error: Error) => void; }; /** * ✅ Cache operations (debug only) */ cache(operation: 'clear', reason: string, stats?: { clearedCount: number; }): { start: () => void; complete: () => void; }; } export {}; //# sourceMappingURL=event-emitter.d.ts.map