Advertisement
Guest User

RXJS custom withLatestFrom

a guest
Apr 14th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.42 KB | Software | 0 0
  1. // Comment for https://stackoverflow.com/a/75048174/8234174
  2. const source = new Subject();
  3. const one = new Subject();
  4. const two = new Subject();
  5.  
  6. source.pipe(awaitLatestFrom([one, two])).subscribe(data => console.log('Entered with data:', data));
  7.  
  8. source.next('A');
  9. one.next("One")
  10. source.next('B');
  11. two.next("Two")
  12. // Will not log "Entered with data", as 'one' has not fired again since 'source' has nexted value 'B'
Tags: rxjs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement