Created
November 11, 2019 10:49
-
-
Save CharlieGreenman/59801cba4edd024ed752c126cc3450e4 to your computer and use it in GitHub Desktop.
Hot Observable with two subscribers
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
| import { Subject } from 'rxjs'; | |
| const random = Math.random(); | |
| const randomVal$ = new Subject().next(random); | |
| // Subscribe to run the combined functions | |
| randomVals$.subscribe(x => console.log(x)); | |
| // 0.8771441274333971 (random number) | |
| randomVals$.subscribe(x => console.log(x)); | |
| // 0.8771441274333971 (random number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment