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

  • Mastering Reactive JavaScript
  • Erich de Souza Oliveira
  • 137字
  • 2021-07-09 20:33:11

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.

主站蜘蛛池模板: 钦州市| 五华县| 杭锦后旗| 福贡县| 仙游县| 石河子市| 宜章县| 兴隆县| 丰城市| 白河县| 宁波市| 江油市| 乐清市| 漳平市| 改则县| 饶阳县| 凤城市| 晋江市| 会东县| 平和县| 葫芦岛市| 分宜县| 湖南省| 宣恩县| 博白县| 广水市| 富蕴县| 镇康县| 贡嘎县| 县级市| 开阳县| 绥宁县| 郸城县| 牡丹江市| 新干县| 石家庄市| 波密县| 无为县| 彩票| 云南省| 汉寿县|