daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
Top