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

  • 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.

主站蜘蛛池模板: 龙胜| 宁波市| 永清县| 卫辉市| 内乡县| 华安县| 海门市| 托克托县| 长海县| 长武县| 金堂县| 建平县| 宜良县| 海安县| 思茅市| 铜山县| 册亨县| 盐源县| 奉新县| 永胜县| 枞阳县| 南宁市| 武安市| 清苑县| 双城市| 枝江市| 彰化市| 图们市| 会东县| 洛南县| 海安县| 凌海市| 渝中区| 绵竹市| 乐安县| 盖州市| 日土县| 唐山市| 河曲县| 长子县| 漾濞|