当使用rxjs时,有一些困惑是
takeUntil
操作员的行为
combineLatest
使用时
pipe
.
有必要加上
取到
每一个内部可见的像这样包括一个管道
取到
:
import {combineLatest} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
combineLatest(
this._store.pipe(select(stateOfLocation), takeUntil(this._destroy)),
this._store.pipe(select(stateOfPlacesSelected), takeUntil(this._destroy))
)
.pipe(takeUntil(this._destroy$))
.subscribe( ([location, places]) => {
/* Business Logic */
});
…还是会
pipe(takeUntil(this._destroy$))
处理来自
组合最
,像这样:
combineLatest(
this._store.pipe(select(stateOfLocation)),
this._store.pipe(select(stateOfPlacesSelected))
)
.pipe(takeUntil(this._destroy$))
.subscribe( ([location, places]) => {
/* Business Logic */
});
我的猜测是后者是正确的,但我想再次检查,以确保我是正确理解这一点。