Slide 34
Slide 34 text
Deep dive to Rx
Hot, Cold Observable - ্ྲྀʹର͢ΔӨڹ
Hot ObservableΛCold Observableʹม͢Δ
https://gist.github.com/dameleon/9fc3178aaba1f695455234af40730a03#hot-observableΛcold-
observableʹม͢Δ
▸ Hot Observableʹରͯ͠ɺಛఆͷOperator(ྫͷ߹map())Λcall͢ΔͱɺCold Observableͳ
Observable͕ฦΔ
▸ Cold to Hotม, SubjectҎ֎ͷOperatorɺ΄΅શͯCold ObservableʹͳΔ
▸ Cold ObservableΛsubscribe()͢ΔͱɺͦͷCold Observable͕جͱͳΓStreamذ͠ͳ͘ͳΔ(=
Subscriber͝ͱʹStream͕Ͱ͖Δ)
▸ ྫͰɺ"A", "B", “C"ͷonNextͰɺmap()ͰՃ͞Εͨ࣌ࠁ͕શͯҟͳ͍ͬͯΔʹ
▸ ͭ·ΓSubscriberͷ͚ͩɺ`map()`ॲཧ͞ΕΔ͜ͱʹͳΔ
▸ ͦͷCold ObservableΛsubscribe()ͨ͠ͱ͖ɺطʹ্ྲྀͷHot Observableͷ͕ൃߦ͞Ε͍ͯͨ߹ɺͦͷ
Λ؍ଌ͢Δ͜ͱͰ͖ͳ͍(αϯϓϧ, "C"ͷSubscriberɺ"hoge", "fuga"Λ؍ଌͰ͖ͳ͍)