export class EventSubscriber { private listners : { [ key ] : Function [ ] ; } = { } ; subscribe ( key , func ) { if ( ! this . listners [ key ] ) this . listners [ key ] = [ ] ; this . listners [ key ] . push ( func ) ; } dispatch ( key , data ) { if ( this . listners [ key ] ) this . listners [ key ] . forEach ( t => { t . call ( data , data ) ; } ) ; } remove ( key ) { delete this . listners [ key ] ; } }