parent
3a80ab727a
commit
283e9d0ad9
@ -0,0 +1,16 @@ |
||||
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() |
||||
} |
||||
} |
Loading…
Reference in new issue