Ayfri
04/21/2022, 12:52 PMJoffrey
04/21/2022, 12:53 PMAyfri
04/21/2022, 12:54 PMAyfri
04/21/2022, 12:54 PMjw
04/21/2022, 12:54 PMjw
04/21/2022, 12:55 PMAyfri
04/21/2022, 12:55 PMjw
04/21/2022, 12:55 PMJoffrey
04/21/2022, 1:02 PMwindow.postMessage
in browsers with a window, and process.nextTick
on NodeJS. Or it falls back to setTimeout
if neither window
nor process
is available in the environment:
https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/js/src/CoroutineContext.kt#L15
Having coroutines doesn't mean having true parallelism. Coroutines are a framework for dealing with concurrency, just like promises and setTimeout
do. You don't need actual multithreading to run coroutines, they can interleave on a single thread for instance.Ayfri
04/21/2022, 1:05 PMlouiscad
04/21/2022, 2:27 PMephemient
04/21/2022, 2:46 PMWorker
, there isn't much support for it in Kotlin but it's just `postMessage`'ing between independent scripts. (https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.workers/ is wrappers for service workers which are quite a bit more complex than web workers)Ayfri
04/21/2022, 2:52 PMephemient
04/25/2022, 3:48 PM