RxJS Observable - switch && switchMap
阿新 • • 發佈:2018-01-01
map -o body each cti call 返回 higher tput
"switch" subscribes to an Observable that emits Observables, also known as a higher-order Observable.
解釋: “ that emits Observables” 作為前面 “an Observable” 的修飾從句。Each time it observes one of these emitted inner Observables,
the output Observable subscribes to the inner Observable and begins emitting the items emitted by that.
“the output Observable subscribes to the inner Observable and (the output) begins emitting the items emitted by (the inner Observable).” 去掉的“that”其實就是“the inner Observable”Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source Observable, where that function returns an (so-called "inner") Observable.
第一階段:Returns an Observable that (1. blah, blah, blah....) ;
解釋: 返回一個Observable
第二階段:Returns an Observable that emits items (2. blah, blah, blah....) emitted by the source Observable
解釋:返回一個會emits items的Observable。
這些 items 是 emited 自 the source Observable 的。
(說明是兩層Observable, 即 higher-order Observable)
解釋:第二階段中 每個 item 都是由你所提供的(自定義) function 加工過的
RxJS Observable - switch && switchMap