export class Event { data : string ; } export type Listener = ( event : Event ) => void ; export class EventDispatcher { events : Array < Listener > = new Array ( ) ; } export const listener = ( event ) => { } ; export const anotherListener = ( event ) => { let x = 0 ; x + x ; } ; export function initializeDispatcher ( ) { var eventDispatcher = new EventDispatcher ( ) ; eventDispatcher . events . push ( listener ) ; eventDispatcher . events . push ( anotherListener ) ; return eventDispatcher ; }