UNPKG

@ima/core

Version:

IMA.js framework for isomorphic javascript application

71 lines 2.71 kB
import { Dispatcher, DispatcherEventsMap, DispatcherListener, DispatcherListenerAll } from './Dispatcher'; import { Dependencies } from '../oc/ObjectContainer'; /** * Default implementation of the {@link Dispatcher} interface. */ export declare class DispatcherImpl extends Dispatcher { protected _eventListeners: Map<string, Map<DispatcherListener<any>, Set<unknown>>>; protected _eventListenersAll: Map<DispatcherListenerAll<any>, Set<unknown>>; static $dependencies: Dependencies; /** * Initializes the dispatcher. */ constructor(); /** * @inheritDoc */ clear(): this; /** * @inheritDoc */ listen(event: string, listener: DispatcherListener<any>, scope?: unknown): this; /** * @inheritDoc */ listenAll(listener: DispatcherListenerAll<any>, scope?: unknown): this; /** * @inheritDoc */ unlisten(event: string, listener: DispatcherListener<any>, scope?: unknown): this; unlistenAll(listener: DispatcherListenerAll<any>, scope?: unknown): this; /** * @inheritDoc */ fire<E extends string | keyof DispatcherEventsMap>(event: E, data: any): this; /** * Create new Map storage of listeners for the specified event. * * @param event The name of the event. */ _createNewEvent(event: string): void; /** * Create new Set storage of scopes for the specified event and listener. * * @param event The name of the event. * @param listener The event listener. */ _createNewListener<L extends DispatcherListener<any>>(event: string, listener: L): void; /** * Retrieves the scopes in which the specified event listener should be * executed for the specified event. * * @param event The name of the event. * @param listener The event listener. * @return The scopes in which the specified listeners * should be executed in case of the specified event. The returned * set is an unmodifiable empty set if no listeners are registered * for the event. */ _getScopesOf<L extends DispatcherListener<any>>(event: string, listener: L): Readonly<Set<unknown>>; /** * Retrieves the map of event listeners to scopes they are bound to. * * @param event The name of the event. * @return A map of event listeners to the * scopes in which they should be executed. The returned map is an * unmodifiable empty map if no listeners are registered for the * event. */ _getListenersOf(event: string): Readonly<Map<DispatcherListener<any>, Set<unknown>>>; } //# sourceMappingURL=DispatcherImpl.d.ts.map