Skip to content

Instantly share code, notes, and snippets.

@hadilq
Last active November 5, 2018 19:44
Show Gist options
  • Save hadilq/d927302e86f3bad148661d435d3113d9 to your computer and use it in GitHub Desktop.
Save hadilq/d927302e86f3bad148661d435d3113d9 to your computer and use it in GitHub Desktop.
abstract class BaseViewModel : ViewModel() {
val actionStream = PublishSubject.create<Action>()
private val compositeDisposable: CompositeDisposable = CompositeDisposable()
protected fun Disposable.track() {
compositeDisposable.add(this)
}
override fun onCleared() {
compositeDisposable.clear()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment