I want to have multiple observables scheduled consistently with forkJoin, but want to subscribe each of them individually, like below.
const ox = http.get('x');
const oy = http.get('y');
const all = interval(1000).pipe(
switchMap(
() => forkJoin(ox, oy)
);
);
// component x
const sx = ox.subscribe((x) => { showX(x); });
// component y
const sy = oy.subscribe((y) => { showY(y); });
// Another component
const sAll = all.subscribe(([x, y]) => { doStuffThatNeedsBothXY(x, y); });
What would be a best way to do this? I want to keep ox
and oy
type as Observable, instead of using other techniques like piping side effect (tap
) at all
.