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

  • 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().
主站蜘蛛池模板: 磴口县| 聂拉木县| 曲阜市| 恩施市| 双江| 乌兰县| 梨树县| 榆社县| 郎溪县| 厦门市| 聊城市| 长春市| 讷河市| 通州市| 泰兴市| 景泰县| 宕昌县| 永州市| 丹阳市| 武威市| 原阳县| 浦东新区| 白朗县| 朔州市| 谢通门县| 菏泽市| 察雅县| 从江县| 新昌县| 泽普县| 苏尼特左旗| 苗栗县| 讷河市| 滨州市| 徐水县| 濮阳县| 美姑县| 中卫市| 阜阳市| 揭阳市| 商水县|