Observable which does not pass anything in onNext()

前端 未结 6 955
猫巷女王i
猫巷女王i 2021-02-02 06:52

I would need an Observable, for example to provide a system clock, which does not need to pass anything in onNext(). I couldn\'t find a signature that would allow me to do that.

6条回答
  •  旧巷少年郎
    2021-02-02 07:20

    Starting with RxJava 2, the propper way to do this is to use a Completable

    From the docs:

    Represents a deferred computation without any value but only indication for completion or exception. The class follows a similar event pattern as Reactive-Streams: onSubscribe (onError|onComplete)?

提交回复
热议问题