type EventCallback = (data?: any) => void; export default class EventEmitter { private events; private shouldDebugListenerLifecycle; private logListenerLifecycle; /** * Registers a listener for an event. * * Important lifecycle contract: * - Callers that register with `on()` are responsible for calling `off()` * when the listener is no longer needed, unless the entire emitter instance * is guaranteed to be discarded immediately after use. * - Registering the same callback multiple times will produce multiple invocations. */ on(event: string, callback: EventCallback): this; /** * Registers a one-shot listener that removes itself after first invocation. * * Prefer `once()` when the event is expected exactly once (for example, "ready") * to reduce manual listener management burden. */ once(event: string, callback: EventCallback): this; /** * Unregisters a previously registered listener for an event. * * This method is idempotent: if the event/callback pair is not present, * no exception is thrown and the emitter is unchanged. */ off(event: string, callback: EventCallback): this; /** * Returns the number of listeners currently registered for an event. */ listenerCount(event: string): number; /** * Removes all listeners for one event, or all events when omitted. * * Use with care in shared emitters: it can detach listeners owned by other * consumers when called without a specific `event`. */ removeAllListeners(event?: string): this; /** * Dispatches an event to the current listener snapshot. * * The listener array is cloned before iteration to avoid mutation issues * when listeners call `off()` or `on()` during event handling. */ protected emit(event: string, data?: any): void; } export {}; //# sourceMappingURL=EventEmitter.d.ts.map