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

Nikky

01/12/2020, 8:22 PM
so in kotlin/js on the browser.. what is the easiest way to launch a coroutines (ktor client) ? as far as i can tell there is no functions like
runBlocking
in coroutines-core-js
o

octylFractal

01/12/2020, 8:27 PM
use
launch
on a
CoroutineScope
such as the
GlobalScope
, or preferably your own application-specific scope
there is no
runBlocking
because it doesn't make sense given JS's threading model (there is none).
runBlocking
implies blocking the current thread, but in JS, there is no other thread, so if your coroutines suspend inside
runBlocking
, what can resume them? where would the code continue from a suspension point?
👍 2
4 Views