was published into the experimental repo. To be compatible with current 1.9.20 toolchain one have to wrap main function into
runEventLoop
function call, like:
Copy code
// main or other "root" function
fun main() = kotlinx.coroutines.runEventLoop {
GlobalScope.launch {
// suspend function call
}
}
A coroutine test, that uses ``kotlinx.coroutines.test`` can be written as usual, like:
Copy code
@Test
fun myTest() = kotlinx.coroutines.test.runTest {
// suspend function call
}
K 4
π 2
βΈοΈ 4
b
bashor
01/02/2024, 6:38 PM
@sdeleuze JFYI
π 1
h
hfhbd
01/02/2024, 8:55 PM
Can you provide some technical details, how did you solve the missing platform apis? Looking at the source code its is a single "thread"/event loop solution using global variables.
i
Igor Yakovlev
01/03/2024, 12:55 PM
Yes. It is single thread event loop. Delayed coroutine uses blocking timer. As far as wasm is single-threaded now this is the only solution we see.