Created
July 10, 2019 14:54
-
-
Save l0co/4339fb9ed08fa30f54d676660f18ee4f to your computer and use it in GitHub Desktop.
RxJs BehaviorSubject used as the pipe in TypeScirpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let subject = new BehaviorSubject<string>('0'); | |
| subject.subscribe(it => console.log('@@@@@@@@@@@@', 'A', it)); | |
| console.log('@@@@@@@@@@@@', 'emit', '1'); | |
| subject.next('1'); | |
| subject.subscribe(it => console.log('@@@@@@@@@@@@', 'B', it)); | |
| console.log('@@@@@@@@@@@@', 'emit', '2'); | |
| subject.next('2'); | |
| subject.subscribe(it => console.log('@@@@@@@@@@@@', 'C', it)); | |
| // @@@@@@@@@@@@ A 0 | |
| // @@@@@@@@@@@@ emit 1 | |
| // @@@@@@@@@@@@ A 1 | |
| // @@@@@@@@@@@@ B 1 | |
| // @@@@@@@@@@@@ emit 2 | |
| // @@@@@@@@@@@@ A 2 | |
| // @@@@@@@@@@@@ B 2 | |
| // @@@@@@@@@@@@ C 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment