/** * Remove listeners that match listener * @param targetListeners is an array of listener arrays or event objects with arrays of listeners * @param listener the listener callback to remove * @param eventFilter (optional) event name instructing the function to only remove listeners for the specified event */ export declare function removeListener(targetListeners: (Function[] | Record)[], listener: Function, eventFilter?: string): void; export declare function inspect(args: unknown): string; export declare class InvalidArgumentError extends Error { constructor(...args: [string | undefined]); } export type EventMap = Record; export type EventKey = string & keyof T; export type EventListener = (params: T) => void; export default class EventEmitter { any: Array; events: Record; anyOnce: Array; eventsOnce: Record; constructor(); /** * Add an event listener * @param listenerOrEvents (optional) the name of the event to listen to or the listener to be called. * @param listener (optional) the listener to be called. */ on>(listenerOrEvents?: K | K[] | EventListener, listener?: EventListener): void; /** * Remove one or more event listeners * @param listenerOrEvents (optional) the name of the event whose listener is to be removed. If not supplied, * the listener is treated as an 'any' listener. * @param listener (optional) the listener to remove. If not supplied, all listeners are removed. */ off>(listenerOrEvents?: K | K[] | EventListener, listener?: EventListener): void; /** * Get the array of listeners for a given event; excludes once events * @param event (optional) the name of the event, or none for 'any' * @return array of events, or null if none */ listeners>(event: K): Function[] | null; /** * Emit an event * @param event the event name * @param arg the arguments to pass to the listener */ emit>(event: K, arg: T[K]): void; /** * Listen for a single occurrence of an event * @param listenerOrEvents (optional) the name of the event to listen to * @param listener (optional) the listener to be called */ once>(listenerOrEvents: K | K[] | EventListener, listener?: EventListener): void | Promise; /** * Private API * * Listen for a single occurrence of a state event and fire immediately if currentState matches targetState * @param targetState the name of the state event to listen to * @param currentState the name of the current state of this object * @param listener the listener to be called * @param listenerArgs */ whenState(targetState: string, currentState: string, listener: EventListener, ...listenerArgs: unknown[]): Promise | undefined; }