Guest User

Untitled

a guest
Feb 13th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. const s = new Subject();
  2. const subscriber1 = s.subscribe(...);
  3. const subscriber2 = s.subscribe(...);
  4. s.complete(); // both subscribers will receive the complete notification
  5.  
  6. // or with `take(1)` operator it'll call `complete()` for you
  7. const subscriber1 = s.take(1).subscribe(...);
  8. const subscriber2 = s.take(1).subscribe(...);
  9. s.next(42); // both subscribers will receive the complete notification
Add Comment
Please, Sign In to add comment