/** * Default event map: string event names → tuple of payload args. * * The index-signature value is `unknown[]` (SD-3213 EventEmitter drain). * Specific event maps that extend this still type their known events * precisely (see `EditorEventMap`); the index-signature fallback only * governs untyped event names like `editor.on('arbitraryEvent', cb)`, * where consumers now get `cb: (...args: unknown[]) => void` instead * of `any[]`. That keeps unsafe IntelliSense collapse out of the * public surface while leaving typed events untouched. */ export type DefaultEventMap = Record; /** * Event callback function type. * * Default `Args extends unknown[] = unknown[]` (was `any[]`, SD-3213). * Variance: when a specific event map provides a tighter tuple via * `EventMap[K]`, that flows through to `EventCallback` at * the call site, so typed events keep their precise payloads. */ export type EventCallback = (...args: Args) => void; /** * EventEmitter class is used to emit and subscribe to events. * * @typeParam EventMap - Map of event names to their argument types. */ export declare class EventEmitter { #private; /** * Subscribe to the event. * @param name Event name. * @param fn Callback. */ on(name: K, fn: EventCallback): void; /** * Emit event. * @param name Event name. * @param args Arguments to pass to each listener. */ emit(name: K, ...args: EventMap[K]): void; /** * Emit event with per-listener isolation. * Every registered listener is invoked even if earlier listeners throw. * Exceptions are collected and returned so the caller can log or handle them. */ safeEmit(name: K, ...args: EventMap[K]): Error[]; /** * Remove a specific callback from event * or all event subscriptions. * @param name Event name. * @param fn Callback. */ off(name: K, fn?: EventCallback): void; /** * Subscribe to an event that will be called only once. * @param name Event name. * @param fn Callback. */ once(name: K, fn: EventCallback): void; /** * Remove all registered events and subscriptions. */ removeAllListeners(): void; } //# sourceMappingURL=EventEmitter.d.ts.map