export default class Signal { private listeners : any [ ] ; constructor ( ) { this . listeners = [ ] ; } public addListener ( listener ) { this . listeners . push ( listener ) ; } public removeListener ( listener ) { const index = this . listeners . indexOf ( listener ) ; if ( index >= 0 ) { this . listeners . splice ( index , 1 ) ; } } public dispatch ( ... args ) { this . listeners . forEach ( listener => { listener ( ... args ) ; } ) ; } }