Web version of Jetsnack application built with Compose Multiplatform for Web and Kotlin/Wasm.
Kotlin/Wasm is a new experimental target that enables developers to compile Kotlin code to WebAssembly (Wasm).
By compiling Kotlin code to WebAssembly, you can run it on any WebAssembly-compatible environment that meets Kotlin's requirements, including web browsers. This creates numerous opportunities, such as developing high-performance web applications and serverless functions.
Compose for Web is based on Kotlin/Wasm, the newest target for Kotlin Multiplatform projects. It allows you to run your code in the browser with all the benefits that WebAssembly has to offer, such as good and predictable performance for your applications.
We recommend using IntelliJ IDEA 2023.1 or later to work with the project. It has Kotlin/Wasm support out of the box.
To run applications built with Kotlin/Wasm in a browser, you need a browser supporting wasm garbage collection feature:
- For Chrome and Chromium-based browsers (Edge, Brave etc.), it should just work since version 119.
- For Firefox 120 it should just work.
- For Firefox 119:
- Open
about:config
in the browser. - Enable javascript.options.wasm_gc.
- Refresh the page.
- Open
For more information see https://kotl.in/wasm_help/.
Check out the repository, navigate to the project folder, and use the following commands:
###un Web version via Gradle R
Run the following Gradle command in the terminal: ./gradlew :web:wasmJsRun
Once the application starts, open the following URL in your browser: http://localhost:8080
Run the following Gradle command in the terminal: ./gradlew :desktop:run
Run the following Gradle command in the terminal: ./gradlew :android:installDebug