export class BehavioralSubject < A > { private subscribers : Array < ( value : A ) => void > = [ ] ; private _value : A ; constructor ( value ) { this . _value = value ; } public next ( value ) { this . _value = value ; this . subscribers . forEach ( ( observer ) => observer ( this . _value ) ) ; } public subscribe ( observer ) { observer ( this . _value ) ; this . subscribers . push ( observer ) ; } }