官术网_书友最值得收藏!

Hot and cold observables

In bacon.js, an observable only emits a value when a subscriber subscribes to it; therefore, we will call it a cold observables. In Reactive Extensions, things can become a little trickier: we have both hot and cold observables.

A hot observable is an observable that propagates the data independently, irrespective of whether we have some Observer attached to it or not. An example of a hot observable is an observable created from mouse movements.

A cold observable, on the other hand, is an observable that fires the same sequence for all the subscribers. An example of a cold observable is an observable created from an array.

This behavior is important to understand, and RxJS has special methods to replay events in a hot observable or turn a cold observable into a hot observable.

主站蜘蛛池模板: 沙洋县| 阳新县| 西林县| 蒙城县| 思南县| 陇川县| 阿拉尔市| 余江县| 绵阳市| 新龙县| 石阡县| 建宁县| 桐柏县| 揭西县| 彭山县| 宁陵县| 克拉玛依市| 南和县| 宣汉县| 商洛市| 海口市| 洞头县| 天峻县| 商丘市| 璧山县| 富平县| 武威市| 阳城县| 龙山县| 大悟县| 平舆县| 探索| 文水县| 南开区| 航空| 临朐县| 永德县| 石景山区| 正宁县| 海兴县| 嘉荫县|