Skip to content

Instantly share code, notes, and snippets.

@kaiguogit
Created February 12, 2021 01:11
Show Gist options
  • Save kaiguogit/60c15f9e06179d37368043ef3684a865 to your computer and use it in GitHub Desktop.
Save kaiguogit/60c15f9e06179d37368043ef3684a865 to your computer and use it in GitHub Desktop.
filter-combinelatest
const { rxObserver } = require('api/v0.3');
const { timer, combineLatest } = require('rxjs');
const { take, filter } = require('rxjs/operators');
const a$ = timer(0, 10).pipe(
take(5)
);
const b$ = timer(0, 4).pipe(
take(7)
);
const c$ =timer(0, 10).pipe(take(5), filter(() => false))
const result$ = combineLatest(a$, b$, c$);
a$.subscribe(rxObserver('a$'));
b$.subscribe(rxObserver('b$'));
b$.subscribe(rxObserver('c$'));
result$.subscribe(rxObserver('combineLatest(a$, b$)'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment