Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created May 3, 2021 09:06
Show Gist options
  • Save armanozak/5d50f6d1d7535e18291af5fba87b7e42 to your computer and use it in GitHub Desktop.
Save armanozak/5d50f6d1d7535e18291af5fba87b7e42 to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] RxJS 7 zipWith #blog #rxjs
import { interval } from "rxjs";
import { map, zipWith } from "rxjs/operators";
const count1To5$ = interval(1000).pipe(
take(5),
map(i => i + 1)
);
const count6To9$ = interval(1000).pipe(
take(4),
map(i => i + 6)
);
count1To5$.pipe(zipWith(count6To9$)).subscribe(console.log);
// (~1s apart) [1,6], [2,7], [3,8], [4,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment