Scoping jobs and subscriptions in desktop #179
-
Hi, I have a question in the documentation in theme "Scoping jobs and subscriptions", the component gets a coroutineContext, then with extension(in the documentation like LifecycleOwner.coroutineScope) it creates a scope. Ok, and in the documentations advised to create RootComponent before setContent method, so RootComponent create other components, other components ask a coroutineContext, also RootComponent too, in there we can give to RootComponent a coroutineContext in lifecycleOwner in MainActivity, in Android all ok. But in documentation advised to create RootComponent in desktop(JetBrains Compose) before method application, but we need a coroutineContext, we can get coroutineContext with rememberCoroutineScope().currentCoroutineContext, but it will be in the application, how can i give to RootComponent a coroutineContext and do it before application method? Thank you beforehand? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Passing a |
Beta Was this translation helpful? Give feedback.
Passing a
CoroutineContext
has nothing to do with Compose. You can useDispatchers.Main
as mainCoroutineContext
.