Last active
February 12, 2019 19:31
-
-
Save dimrsilva/94356b9ed099d36c1b4475792de08734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class CoroutineViewModel : ViewModel(), CoroutineScope { | |
private val job = Job() | |
override val coroutineContext = Main + job | |
override fun onCleared() { | |
super.onCleared() | |
job.cancel() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment