I've seen two different uses of Coroutines at my company and I'm wondering which is best?
Usage 1
GlobalScope.launch(Dispatchers.IO) {
loadMyData()
}
Usage 2
class MyClass(): GlobalScope {
. . .
launch(Dispatchers.IO){
loadMyData()
}
. . .
}
Is one better than the other? what are the pros and cons of each?