/**
 * Event that has no arguments.
 */ export class Event { private _listeners : EventListener [ ] = [ ] ; public addListener ( listener ) { this . _listeners . push ( listener ) ; } public removeListener ( listener ) { const index = this . _listeners . indexOf ( listener ) ; if ( index !== - 1 ) { this . _listeners . splice ( index , 1 ) ; } } public removeAllListeners ( ) { this . _listeners = [ ] ; } public invoke ( ) { this . _listeners . forEach ( l => { l ( ) ; } ) ; } } /**
 * Signature of event listener that has no arguments.
 */ declare type EventListener = ( ) => void ; /**
 * Event that takes typed argument.
 */ export class ArgEvent < T > { private _listeners : ArgEventListener < T > [ ] = [ ] ; public addListener ( listener ) { this . _listeners . push ( listener ) ; } public removeListener ( listener ) { const index = this . _listeners . indexOf ( listener ) ; if ( index !== - 1 ) { this . _listeners . splice ( index , 1 ) ; } } public removeAllListeners ( ) { this . _listeners = [ ] ; } public invoke ( arg ) { this . _listeners . forEach ( l => { l ( arg ) ; } ) ; } } /**
 * Signature of event listener that accepts typed argument.
 */ declare type ArgEventListener < T > = ( arg : T ) => void ;