import { EventMapping } from "./api/EventMapping";
import { EventListener } from "./api/EventListener";
import { Event } from "./event/Event";
/**
* Event dispatcher class which implements event exchange functionality.
*/
export declare class EventDispatcher {
/**
* List of all event mappings known to event dispatcher
*/
private eventMap;
constructor();
/**
* Add event listener.
* @param event Event name for which to listen to
* @param listener Listener function that will be invoked as event with specified name is dispatched.
* @param scope Listener scope which will be applied as listener is invoked. (You can leave it undefined,
* if you don't care about scope that much).
* @returns {EventMapping} Null in case if event name is already mapped to same function. Or EventMapping object
* which is to be used in order to set some of mapping properties like once() which will make listener
* to be executed upon first event dispatch and then be gone.
*/
addEventListener(event: Event['type'], listener: EventListener, scope?: Object): EventMapping;
/**
* Add event listener that will be executed only once.
* @param event Event name for which to listen to
* @param listener Listener function that will be invoked as event with specified name is dispatched.
* @param scope Listener scope which will be applied as listener is invoked. (You can leave it undefined,
* if you don't care about scope that much).
* @returns {EventMapping} Null in case if event name is already mapped to same function. Or EventMapping object
* which is to be used in order to set some of mapping properties like once() which will make listener
* to be executed upon first event dispatch and then be gone.
*/
listenOnce(event: Event['type'], listener: EventListener, scope?: Object): EventMapping;
/**
* Check if event dispatcher has mapping of certain event to listener.
* @param event Target event name.
* @param listener Listener function.
* @param scope Listener scope which will be applied as listener is invoked.
* @returns {boolean} true if event mapping is found and false otherwise
*/
hasEventListener(event: Event['type'], listener?: EventListener, scope?: Object): boolean;
/**
* Remove event listener.
* @param event Target event type.
* @param listener Listener function.
* @param scope Listener scope which will be applied as listener is invoked.
* @returns {boolean} True if event name binding to listener function was found or false if it was found not.
*/
removeEventListener(event: Event['type'], listener: EventListener, scope?: Object): boolean;
/**
* Remove all listeners of a particular event from all scopes or the specified scope.
* @param eventType Event name to be unmapped from all listeners.
* @param scope Listener scope from which all listeners mapped to eventType will be removed.
* @returns {boolean} True if any of mappings have been found; false otherwise.
*/
removeEventListeners(eventType: Event['type'], scope?: Object): boolean;
/**
* Remove all listeners registered with specified scope or with the whole dispatcher instance.
* @param scope Scope from which all listeners mapped listeners will be removed. If not specified,
* all listeners will be removed from whole dispatcher instance.
* @returns {boolean} True if any listeners to remove where found; false otherwise.
*/
removeAllEventListeners(scope?: Object): boolean;
/**
* Dispatch event object to all subscribed listeners.
* @param event Event object that defines event type and data
* @returns {boolean} True if default action of event has not been prevented in any of its listeners.
*/
dispatchEvent(event: Event): boolean;
/**
* Dispatch event notification by separate type and data arguments.
* @param eventType Event type to be dispatched.
* @param eventData Arbitrary data to ship along with event dispatch.
* @returns {boolean} True if default action of event has not been prevented in any of its listeners
*/
dispatchEvent(eventType: Event['type'], eventData?: any): boolean;
/**
* Lookup event mappings by event name or name and listener combination.
* @param eventType Event name to look bindings for.
* @param listener Listener which, if provided, will also be used as mappings filter criteria.
* @param scope Scope upon which listener should be executed.
* @returns {EventMappingImpl[]} List of event mappings or empty list if no mappings are found.
*/
private getEventMappings;
/**
* Create a new event mapping.
* @param event Event name for which mapping will be created
* @param listener Listener function which will be mapped.
* @param scope Listener scope which will be mapped.
* @returns {EventMappingImpl} Instance of the created event mapping.
*/
private createMapping;
/**
* Remove provided event mappings.
* @param mappings All mappings to be removed.
* @returns {boolean} True if mappings have been removed; false if provided mappings are empty.
*/
private removeMappings;
/**
* Implement actual event dispatching
* @param event Event to dispatch
* @returns {boolean} True if default action of event has not been prevented in any of its listeners
*/
protected dispatchEventImpl(event: Event): boolean;
/**
* Number of active listeners on this dispatcher instance.
* @returns {number}
*/
get listenerCount(): number;
}