Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import { interval } from 'rxjs';
  2. import { map, withLatestFrom, take } from 'rxjs/operators';
  3.  
  4. const sportsNews$ = interval(5000).pipe(
  5. map(i => `Sport News ${i}`)
  6. );
  7.  
  8. const worldNews$ = interval(1000).pipe(
  9. map(i => `World News ${i}`)
  10. );
  11.  
  12. const customizedNews$ = sportsNews$.pipe(
  13. withLatestFrom(worldNews$),
  14. map(([sportNews, worldNews]) => `Sport: ${sportNews}; World: ${worldNews}`),
  15. take(3)
  16. )
  17.  
  18. customizedNews$.subscribe(console.log);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement