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

  • Learning RxJava
  • Thomas Nield
  • 161字
  • 2021-07-02 22:22:51

How Observables work

Before we do anything else, we need to study how an Observable sequentially passes items down a chain to an Observer. At the highest level, an Observable works by passing three types of events:

  • onNext(): This passes each item one at a time from the source Observable all the way down to the Observer.
  • onComplete(): This communicates a completion event all the way down to the Observer, indicating that no more onNext() calls will occur.
  • onError(): This communicates an error up the chain to the Observer, where the Observer typically defines how to handle it. Unless a retry() operator is used to intercept the error, the Observable chain typically terminates, and no more emissions will occur.

These three events are abstract methods in the Observer type, and we will cover some of the implementation later. For now, we will focus pragmatically on how they work in everyday usage.

In RxJava 1.0, the onComplete() event is actually called onCompleted().
主站蜘蛛池模板: 津南区| 晋城| 武功县| 孟州市| 宁明县| 莱阳市| 长汀县| 娱乐| 木里| 板桥市| 宣武区| 万山特区| 若尔盖县| 南充市| 资阳市| 晋宁县| 曲麻莱县| 沙田区| 新兴县| 乌拉特前旗| 香河县| 新巴尔虎左旗| 珠海市| 秦皇岛市| 监利县| 玉树县| 乌拉特后旗| 射洪县| 普定县| 彭水| 呼伦贝尔市| 镇赉县| 苍梧县| 斗六市| 夏河县| 武乡县| 休宁县| 德州市| 施秉县| 银川市| 镇沅|