import type { Event } from './Event'; import type { EventListener } from './EventListener'; /** * A record used to map events. * Each entry contains an event name with associated event interface. * * @example * ``` * { * 'statechange': StateChangeEvent, * 'error': ErrorEvent * } * ``` * * @public */ export type EventMap = Record>; /** * Helper type to extract string keys from type objects. * * @public */ export type StringKeyOf = Extract; /** * Dispatches events that are fired. * * @public */ export interface EventDispatcher>> { /** * Add the given listener for the given event type(s). * * @param type - The type of the event. * @param listener - The callback which is executed when the event occurs. */ addEventListener>(type: TType | readonly TType[], listener: EventListener): void; /** * Remove the given listener for the given event type(s). * * @param type - The type of the event. * @param listener - The callback which will be removed. */ removeEventListener>(type: TType | readonly TType[], listener: EventListener): void; }