Skip to content

Commit c8dd346

Browse files
committed
Added no argument subscribeUntilDetached.
1 parent d69272f commit c8dd346

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/kotlin/com/mvcoding/mvp/Presenter.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ abstract class Presenter<VIEW : Presenter.View> {
3232
viewSubscriptions.add(subscription)
3333
}
3434

35+
protected fun <T> Observable<T>.subscribeUntilDetached() = subscribe().apply { unsubscribeOnDetach(this) }
36+
3537
protected fun <T> Observable<T>.subscribeUntilDetached(onNext: (T) -> Unit) = subscribe(onNext).apply { unsubscribeOnDetach(this) }
3638

3739
protected fun <T> Observable<T>.subscribeUntilDetached(onNext: (T) -> Unit, onError: (Throwable) -> Unit) =

0 commit comments

Comments
 (0)