Created
August 20, 2020 18:51
-
-
Save manuelernesto/1ec92420cf73dea3bc0d2e163124c34e 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 StandardFragment:Fragment(),CoroutineScope { | |
private lateinit var job: Job | |
override val coroutineContext: CoroutineContext | |
get() = job + Dispatchers.Main | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
job = Job() | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
job.cancel() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment