import Map from '@dojo/shim/Map'; import { Handle, EventType, EventObject } from './interfaces'; import { Destroyable } from './Destroyable'; /** * Determines is the event type glob has been matched * * @returns boolean that indicates if the glob is matched */ export declare function isGlobMatch(globString: string | symbol, targetString: string | symbol): boolean; export declare type EventedCallback = EventObject> = { /** * A callback that takes an `event` argument * * @param event The event object */ (event: E): boolean | void; }; export interface CustomEventTypes = EventObject> { [index: string]: T; } /** * A type which is either a targeted event listener or an array of listeners * @template T The type of target for the events * @template E The event type for the events */ export declare type EventedCallbackOrArray = EventObject> = EventedCallback | EventedCallback[]; /** * Event Class */ export declare class Evented = EventObject> extends Destroyable { protected __typeMap__?: M; /** * map of listeners keyed by event type */ protected listenersMap: Map[]>; /** * Emits the event object for the specified type * * @param event the event to emit */ emit(event: M[K]): void; emit(event: O): void; /** * Catch all handler for various call signatures. The signatures are defined in * `BaseEventedEvents`. You can add your own event type -> handler types by extending * `BaseEventedEvents`. See example for details. * * @param args * * @example * * interface WidgetBaseEvents extends BaseEventedEvents { * (type: 'properties:changed', handler: PropertiesChangedHandler): Handle; * } * class WidgetBase extends Evented { * on: WidgetBaseEvents; * } * * @return {any} */ on(type: K, listener: EventedCallbackOrArray): Handle; on(type: T, listener: EventedCallbackOrArray): Handle; private _addListener(type, listener); } export default Evented;