doOnBeforeFinally

fun <T> Single<T>.doOnBeforeFinally(action: () -> Unit): Single<T>

Calls the action when one of the following events occur:

  • The Single signals a terminal event: either onSuccess or onError (the action is called before the observer is called).

  • The Disposable sent to the observer via onSubscribe is disposed (the action is called before the upstream is disposed).

Please refer to the corresponding RxJava document.