coroutines & JVM/JavaScript: as far is I unde...
# coroutines
b
coroutines & JVM/JavaScript: as far is I understood it, you'd start a coroutine in a JVM environment using runBlocking if you are not hooking into an event loop engine and use the IO or Default Dispatchers how do coroutines integrate with the async infrastructure in JS?
1
s
On JS, the default dispatcher is the same as the main dispatcher, and dispatches coroutines on the browser's main event loop.
b
so just GlobalScope.launch the root of your application?
s
Even better, use a suspending
main
function
b
oh, that makes sense, thank you
p
For jvm suspend main also works