Hi everyone! I'm planning to work on improving exp...
# javascript
s
Hi everyone! I'm planning to work on improving experience with web workers in Kotlin JS. So, it is very important for me to know the opinion of the community. Please, share your problems, wishes and thoughts regarding the following topics: • web workers generally • coroutines in Kotlin JS • concurrency in JavaScript (your experience with libraries, use cases etc.) For more information about this feature you can read design notes: https://github.com/Kotlin/KEEP/blob/master/notes/web-workers.md
👀 4
🙏 4
t
My use case - workers without coroutines: • Data -
ByteArray
, JSO (default browser serialization) • Worker - separate subproject, because still no entry points support • Build fixes -
runtimeOnly
dependency on worker • Plugin for development/production build (legacy/IR) For fine start classic Web Worker support (without coroutines, without compiler plugin) is preferred. Otherwise this feature will block future Kotlin/JS evolution.
s
Can you provide some example project that uses your plugin?
t
Examples are here
s
@turansky have you seen this blogpost https://avwie.github.io/multithreaded-web-applications-in-kotlin-with-web-workers ? It proposes some tricks for building workers. So, as I can understand, the main problem with workers is poor tooling support?
t
1. Tooling update not required if you have fine output (file to file compilation) 2. Serialization isn’t required if we will have safe JSO builders, which also support
ByteArray
(JSON serialization - not) 3. Custom coroutines sugar looks like more preferable option, in my cases it’s not required at all