What about using `class MainPresenter : CoroutineS...
# coroutines
d
What about using
class MainPresenter : CoroutineScope by CoroutineScope(Dispatchers.Main)
to get rid of a bit of boilerplate, just missing an easy way to access its Job to cancel it on the end of its lifecycle...?
g
you can easily access job using
coroutineContext
you can even just call
coroutineContext.cancel()
d
Good idea, thanks! I guess anyways it'll only have one Job instance there... I thought cancel was only on Job. Doesn't make sense to cancel other contexts, does it?
g
Yes, one Job instance, so this will not work for things that has complicated lifecycle. like fragments