flatMap is deprecated and replaced by mergeMap
import { of, mergeMap, interval, map, take } from 'rxjs';
const letters = of('a', 'b', 'c');
const result = letters.pipe(
mergeMap((x) =>
interval(1000).pipe(
take(4),
map((i) => x + i)
)
)
);
result.subscribe((x) => console.log(new Date().toISOString()x));
// Results in the following:
// a0
// b0
// c0
// a1
// b1
// c1
No comments:
Post a Comment