https://kotlinlang.org logo
#coroutines
Title
# coroutines
k

kingsley

03/04/2017, 8:03 AM
The only other way I could do this is to add an
invokeOnCompletion
to the returned Job for
launch
, but that takes away the fun since I have to repeat it everywhere
e

elizarov

03/04/2017, 8:09 AM
kingsley: It might be also possible with some kind of DI. I have played with it yet, though.
k

kingsley

03/04/2017, 8:13 AM
Yes. I thought about that too. Making the repository instance scoped to the activity. While I don't get to repeat much conpared to
invokeOnCompletion
, it definitely introduces a couple other complexities.
Would have loved if it were possible to promote the
Deferred
object in a way, so I gets aware of the cancellation context. Something like
asyncOp.await(job)
for example, but I don't think there is any mechanism to achieve that
I'll try passing the job around for now, see how comfortable I'm able to get with it
@elizarov ^
2 Views