JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.34k stars 1.12k forks source link

Add wasmJs support to Compose HTML #4461

Open luca992 opened 3 months ago

luca992 commented 3 months ago

compose.html.core is not available for wasmJs. Are there any plans to be add it?

eymar commented 3 months ago

Are there any plans to be add it?

We don't have such plans at the moment. Please share your use cases.

luca992 commented 3 months ago

The same use cases as a js target web app, but backed by wasm. Just like how you can do this in rust with something like leptos.

Wasm kotlin is just faster than js (at least with compose-ui builds) while using less cpu from my experience. Also, I'd hope compiling to wasm could reduce the bundle size after wasm-opt, as compiled js sizes in kotlin are also larger than compiled wasm for compose-ui builds

vdshb commented 3 months ago

I'm also thinking about multi-thread coroutines will be available at WASM-target some day. Hence creating multi-thread business-logic for browser with UI on compose-html would be a good option. Much better than compose-web in many cases.

luca992 commented 3 months ago

I'm also thinking about multi-thread coroutines will be available at WASM-target some day. Hence creating multi-thread business-logic for browser with UI on compose-html would be a good option. Much better than compose-web in many cases.

Unfortunately, I think multithreading on web with wasm is in the same same situation as Js. The only way you can do it is with web workers.

cromefire commented 3 months ago

Unfortunately, I think multithreading on web with wasm is in the same same situation as Js. The only way you can do it is with web workers.

There's work on it to enable threads for webassembly, although it'll probably still take some time to get there.

Might be worth looking at some of the competition though: https://github.com/rjaros/kilua