:kotlinnew::webassembly: + :js: Questions for those interested in using Kotlin/Wasm with JavaScript...
s
K.wasm + js Questions for those interested in using Kotlin/Wasm with JavaScript: • Are you primarily interested in calling JavaScript code from Kotlin, calling Kotlin from JavaScript, or both? • Additionally, if you have tried the current JS interop system, which use-cases that interest you the most are not yet covered? Thanks!
s
1: Calling JS Code from Kotlin where a pure Kotlin KMP library is (yet) missing 2: Can I name unit tests with resources as a use case? šŸ˜…
āž• 1
a
1. Calling Javascript from Kotlin 2. Native support of @JsExport from common code is a use case that is currently not supported 3. A common abstraction layer of definitions for kotlin/js and kotlin/wasm. One that works well with JsAny for both platforms
āž• 1
r
1. Calling JS from Kotlin 2. Array types (see: https://kotlinlang.slack.com/archives/CDFP59223/p1695580635822079) 3. Common layer for K/JS and K/Wasm (including DOM declarations usable from common code, see: https://kotlinlang.slack.com/archives/CDFP59223/p1701875444502719)
šŸ’Æ 1
āž• 2
o
1. Calling JS from Kotlin 2. Catching JS exceptions in Kotlin. 3. Stdlib types like
Promise
as regular commonized Kotlin types, not using
JsAny
.
āž• 1
s
I wish for a lot more extension functions to make this easier. These should be provided by stdlib: •
fun Uint8Array.toByteArray(): ByteArray
•
fun ByteArray.toUint8Array(): Uint8Array
•
fun ByteArray.toBlob(mimeType: String): org.w3c.files.Blob
For a beginner it's not obvious how to implement them and now that I know how to do it i just copy & paste them around. This is a clear indication (to me) that it should come with the standard library.
šŸ™ 1