doOnBeforeDispose

fun <T> Maybe<T>.doOnBeforeDispose(action: () -> Unit): Maybe<T>

Calls the shared action when 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.