2018-04-26 15:33:47 +02:00
|
|
|
import { Event as Event } from '../../Events/Event';
|
|
|
|
export interface EventDispatcher {
|
|
|
|
/**
|
|
|
|
* Adds function `handler` to handle event `type`
|
2018-06-01 14:39:38 +02:00
|
|
|
*
|
|
|
|
* @returns The EventDispatcher object
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
|
|
|
on(type: string, handler: (event: Event) => void): EventDispatcher;
|
|
|
|
/**
|
|
|
|
* Adds function `handler` to handle event `type` just once. The handler will be automatically removed after first execution
|
2018-06-01 14:39:38 +02:00
|
|
|
*
|
|
|
|
* @returns The object that dispatched the event
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
once(type: string, handler: (event: Event) => void): Object;
|
2018-04-26 15:33:47 +02:00
|
|
|
/**
|
|
|
|
* Removes a `handler` from event `type`. If no handler is provided, all handlers will be removed from the event
|
2018-06-01 14:39:38 +02:00
|
|
|
*
|
|
|
|
* @returns The object that dispatched the event
|
2018-04-26 15:33:47 +02:00
|
|
|
*/
|
2018-06-01 14:39:38 +02:00
|
|
|
off(type: string, handler?: (event: Event) => void): Object;
|
2018-04-26 15:33:47 +02:00
|
|
|
}
|