import { AsyncSubject , BehaviorSubject , ReplaySubject , Subject , of , fromEvent } from 'rxjs' ; const event$ = new BehaviorSubject < number > ( 12 ) ; console . log ( `Current value: ${ event$ . getValue ( ) }` ) ; event$ . subscribe ( { next : val => console . log ( `Received ${ val }` ) } ) ; event$ . next ( 42 ) ; console . log ( `Current value: ${ event$ . getValue ( ) }` ) ; event$ . next ( 56 ) ; console . log ( `Current value: ${ event$ . getValue ( ) }` ) ; event$ . next ( 78 ) ; console . log ( `Current value: ${ event$ . getValue ( ) }` ) ;