Is `runBlocking` going to be supported in the JS t...
# coroutines
m
Is
runBlocking
going to be supported in the JS target?
🚫 4
d
It won't.
thank you color 1
j
What would you use it for?
m
Well mainly in compose for reading resources synchronously, but it's not needed, I was just asking.
j
You would freeze the only JS thread if you did this, though. Without using workers, JS is not multi-threaded, so blocking the thread is usually a problem
thank you color 2
c
How would
runBlocking
help with reading resources synchronously? If you're calling a
suspend
function, then you should probably do so in a "real" CoroutineScope
m
The
runBlocking
is going to be running in a non-suspend function. It's synchronous in both cases, but I mean synchronously mostly in terms of UI rendering, loading resources then rendering ui (same as android) instead of doing those two actions in parallel. Because now the UI is rendered with the default font, then the font is loaded, then the UI is rendered again with the new font which doesn't look good. (Now I'm showing a loader when the font is not loaded to prevent this behaviour)