Skip to content

Instantly share code, notes, and snippets.

View fb64's full-sized avatar

Florian Bernard fb64

  • Toulouse, FRANCE
View GitHub Profile
@chrisbanes
chrisbanes / ScopedViewModel.kt
Last active October 25, 2022 21:29
ScopedViewModel
open class ScopedViewModel : ViewModel() {
private val job = Job()
protected val scope: CoroutineScope = job + Dispatchers.Main
override fun onCleared() {
super.onCleared()
job.cancel()
}
}