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

Observables

As we discussed earlier, in reactive programming, Observable has an underlying computation that produces values that can be consumed by a consumer (Observer). The most important thing here is that the consumer (Observer) doesn't pull values here; rather, Observable pushes the value to the consumer. So, we may say, an Observable is a push-based, composable iterator that emits its items through a series of operators to the final Observer, which finally consumes the items. Let's now break things sequentially to understand it better:

  • Observer subscribes to Observable
  • Observable starts emitting items that it has in it
  • Observer reacts to whatever item Observable emits

So, let's delve into how an Observable works through its events/methods, namely, onNext, onComplete, and onError.

主站蜘蛛池模板: 馆陶县| 石狮市| 苏州市| 莒南县| 高平市| 株洲县| 城市| 雷州市| 镇坪县| 大丰市| 上饶市| 乐昌市| 延川县| 福清市| 永德县| 右玉县| 淳安县| 郓城县| 大理市| 永平县| 三原县| 双辽市| 江西省| 罗源县| 抚顺县| 福鼎市| 镇江市| 汾西县| 格尔木市| 西青区| 巨鹿县| 洛浦县| 定安县| 余姚市| 买车| 达州市| 五峰| 曲水县| 红安县| 沈阳市| 武隆县|