通过链接包装 Rx JS Observable
Wrap Rx JS Observable by chaining
有没有办法通过链接将一个 Observable 映射到另一个?我目前正在这样做:
const myObserverable = fnThatReturnsObserverable();
return anotherFunctionThatReturnsObserverable(myObserverable);
有没有办法以链式方式执行此操作?
return fnThatReturnsObserverable().someOperator(anotherFunctionThatReturnsObserverable)
fnThatReturnsObserverable()
.let(obs => anotherFunctionThatReturnsObserverable(obs));
有关它的更多信息here。
您还可以使用 of
和 mergeMap(or concatMap)
Observable.of(fnThatReturnsObserverable())
.mergeMap(ob => anotherFunctionThatReturnsObserverable(obs));
有没有办法通过链接将一个 Observable 映射到另一个?我目前正在这样做:
const myObserverable = fnThatReturnsObserverable();
return anotherFunctionThatReturnsObserverable(myObserverable);
有没有办法以链式方式执行此操作?
return fnThatReturnsObserverable().someOperator(anotherFunctionThatReturnsObserverable)
fnThatReturnsObserverable()
.let(obs => anotherFunctionThatReturnsObserverable(obs));
有关它的更多信息here。
您还可以使用 of
和 mergeMap(or concatMap)
Observable.of(fnThatReturnsObserverable())
.mergeMap(ob => anotherFunctionThatReturnsObserverable(obs));