Pitel
07/22/2021, 9:07 AMrunBlocking
for JS?
The project I'm working has this: expect fun <T> runBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T
I tried someting like:
var result: T? = null
val job = GlobalScope.launch { result = block }
while (!job.isCompleted) {}
return result!!
Yeah, I know it has many mistakes, but the main problem is the while loop block the execution of the coroutine.Big Chungus
07/22/2021, 9:16 AMRobert Jaros
07/22/2021, 9:29 AM