Trying to switch my web common code to using kotl...
# webassembly
p
Trying to switch my web common code to using kotlin-wrappers:kotlin-browser from kotlinx-browser (to get rid of copy/paste common logic for js and wasmJs targtes) kotlin-wrappers:kotlin-browser claims to be common for both js and wasmJs targets, but when trying to compile for wasmJs target got compilation exception
Copy code
Can't link symbol web.streams/ReadableStream.cancelAsync|cancelAsync(js.errors.JsError?){}[0]
I've found issues about it: https://youtrack.jetbrains.com/issue/KT-76567 and https://youtrack.jetbrains.com/issue/KT-68995/ReadableStream-unavailable-in-Kotlin-Wasm So i wonder if anybody had success with using this lib for wasmJs target? If yes then how to workaround this issue? P.S. I'm not using ReadableStream class in my app
r
It's a wrappers issue https://github.com/JetBrains/kotlin-wrappers/issues/2761 caused by a fact it's using Seskar compiler plugin to generate things.
🙏 1
Currently the only workaround is using production builds only.
t
In fact we need some additional compiler support, which already exists in Kotlin/JS
b
JFYI: We have a plan to add K/JS target to kotlinx-browser, but it may take a couple of months since it requires some changes on the toolchain side.
p
Hello, Zalim! Good news! Is there any YT for it?
r
Why do we need two official JB libraries for the same thing?
1
s
r
It's on JetBrains Github account so it is official 🙂
s
Ok, kinda 🙂 actually we have 3 then • org.w3c - only for JS • kotlinx-browser - only for WASM (at least for now) • kotlin-wrappers mostly for JS and partially for WASM with some issues 🙂
sorry, first link is wrong
I tried to figure out what I suppose to use in K/JS now if I want to refer to
Window
and I didn't found it 🙂 To be honest it seems some changes are happening in terms of declarations for browser environment in Kotlin team and I didn't get them yet.
It seems something like this...
b
@PHondogo
Is there any YT for it?
Here they are: • KT-75479 Add Kotlin/JS target into kotlinx.browser library • KT-75480 Add shared source set for js and wasmJs target
thank you color 1
Why do we need two official JB libraries for the same thing?
@Robert Jaros for sure, it would be better to join the efforts, and that’s what we need to discuss.
👍 1