chinwag-android/app/src/main/java/com/keylesspalace/tusky/util/RxAwareViewModel.kt

16 lines
409 B
Kotlin
Raw Normal View History

2019-12-31 23:57:24 +11:00
package com.keylesspalace.tusky.util
import androidx.lifecycle.ViewModel
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
open class RxAwareViewModel : ViewModel() {
val disposables = CompositeDisposable()
fun Disposable.autoDispose() = disposables.add(this)
override fun onCleared() {
super.onCleared()
disposables.clear()
}
}