kevin.cianfarini
05/02/2019, 10:37 PMCoroutineScope
being provided in AndroidX LifeCycle as an extension viewModelScope
versus just having viewmodel implement CorutineScope
?viewModelScope
doesn't use a SupervisorJob
under the hood. That's a non starter for melouiscad
05/02/2019, 10:48 PMSupervisorJob
under the hood. You can see all the latest versions on maven.google.comkevin.cianfarini
05/02/2019, 10:50 PMlouiscad
05/02/2019, 10:51 PMcancel()
from onCleared()
kevin.cianfarini
05/03/2019, 1:02 AMabstract class CoroutineViewModel(private val scope: CoroutineScope) : ViewModel(), CoroutineScope by scope {
override fun onCleared() {
super.onCleared()
this.cancel(CancellationException("ViewModel called onCleared"))
}
}
🙂ghedeon
05/03/2019, 6:38 AMlouiscad
05/03/2019, 10:18 AMonCleared()
override final, or annotate it with @CallSuper
if you still need to override it in subclasses.