为什么不调用内部可观察的运算符tap
和?应该订阅它进入的可观察对象,对吗?为什么这个订阅不会触发那些运营商?map
combineLatest
obsArr
const obsArr = [];
[[1, 2], [3, 4], [5, 6]].map(arr => {
const observable = from(arr);
observable.pipe(
tap(item => {
// this is NOT called
console.log('tap', item)
}),
map(item => {
// this is NOT called
return item * -1;
})
);
obsArr.push(observable);
});
combineLatest(obsArr).subscribe(latestValues => {
console.log(latestValues);
// LOG: [2, 4, 5]
// LOG: [2, 4, 6]
});
工作堆栈闪电战: https ://rxjs-y2h4rn.stackblitz.io
感谢您的解释!