Well mainly in compose for reading resources synchronously, but it's not needed, I was just asking.
j
Joffrey
12/18/2023, 2:59 PM
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
CLOVIS
12/21/2023, 10:48 AM
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
mohamed rejeb
12/21/2023, 11:02 AM
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)