https://kotlinlang.org logo
#javascript
Title
# javascript
d

Djaka Pradana Jaya Priambudi

01/24/2023, 9:24 AM
Hey everyone, is it possible to build a webassembly using kotlin that function as a shared bussiness logic while keep using other regular js framework? I want to share business logic between desktop, mobile and web
👀 1
c

CLOVIS

01/24/2023, 10:15 AM
Why not share it with your web as a Kotlin/JS library? If your goal is to call Kotlin functions from vanilla JS, it will be easier
d

Djaka Pradana Jaya Priambudi

01/24/2023, 10:29 AM
I didn't knew it's possible. So all the kmm function is available to use that way?
c

CLOVIS

01/24/2023, 10:37 AM
All the standard library and KotlinX.* libraries are available in Kotlin/JS, yes. Other than that, it depends
There are more libraries available for Kotlin/JS than Kotlin/Native (Kotlin/WASM is a part of Native) at the moment
d

Djaka Pradana Jaya Priambudi

01/24/2023, 10:53 AM
I see okay noted, thank you 🙇
a

andylamax

01/24/2023, 11:10 AM
Kotlin/WASM is a part of Native at the moment
Is no longer a valid statement. JB has been working for quite sometime now with a new WASM backend that is decoupled from Native
1
c

CLOVIS

01/24/2023, 11:11 AM
Oh, good to know. I assume it's even less stable currently, then?
a

andylamax

01/24/2023, 11:12 AM
Very early stages, yes. @bashor usually posts teasers on #webassembly very frequently. It is so promising though
c

CLOVIS

01/24/2023, 11:14 AM
Well my point was: there are currently many more libraries available for Kotlin/JS than there are for Kotlin/WASM, and they will be easier to use from JS, so that's what I would recommend going with. I do think Kotlin/WASM will be the future for the web platform, but I wouldn't expect to use it in the next 2–3 years
a

andylamax

01/24/2023, 11:33 AM
We do share that perspective
5 Views