///
declare namespace Leaf {
interface EventHandlerInfo {
owner?: any;
once?: boolean;
handler: Function;
}
interface EventHandlers {
[index: string]: EventHandlerInfo[];
}
class EventEmitter {
private events;
constructor();
addEventListener(event: E, handler: Function): this;
on(event: E, handler: Function): this;
once(event: E, handler: Function): this;
listenByOnce(who: any, event: E, handler: Function): this;
listenBy(who: any, event: E, handler: Function): this;
stopListenBy(who: any, event?: E, handler?: Function): this;
removeEventListener(event?: E, handler?: Function): this;
emit(event: E, ...values: any[]): this;
private getOrCreateEventHandlers(event);
}
}