Nikita Lipsky
d9e3528d9e
|
5 months ago | |
---|---|---|
.. | ||
android | 5 months ago | |
common | 6 months ago | |
desktop | 7 months ago | |
gradle | 8 months ago | |
ios | 5 months ago | |
kotlin-js-store | 7 months ago | |
screenshots | 8 months ago | |
web | 7 months ago | |
.gitignore | 5 months ago | |
README.md | 8 months ago | |
build.gradle.kts | 7 months ago | |
gradle.properties | 7 months ago | |
gradlew | 8 months ago | |
gradlew.bat | 8 months ago | |
settings.gradle.kts | 7 months ago |
README.md
Kotlin/Wasm Jetsnack example
This example showcases a web version of the Jetsnack application built with Compose Multiplatform for web and Kotlin/Wasm.
Check it out:
Note: To learn more about the Jetsnack application, visit the Jetsnack README.md.
Kotlin/Wasm
Note: Kotlin/Wasm is an Alpha feature. It may be changed at any time. You can use it in scenarios before production. We would appreciate your feedback in YouTrack.
Kotlin/Wasm is a new target that enables you 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.
With Kotlin/Wasm, you gain the capability to develop high-performance web applications and serverless functions, opening up a wide range of potential projects.
Compose Multiplatform for web
Note: Web support is an Alpha feature. It may be changed at any time. You can use it in scenarios before production. We would appreciate your feedback in GitHub.
Compose Multiplatform for web enables sharing your mobile or desktop UIs on the web.
Compose Multiplatform for web is based on Kotlin/Wasm, the newest target for Kotlin Multiplatform projects. This enables running your code in the browser, leveraging WebAssembly's advantages like high and consistent application performance.
Follow the instructions in the sections below to try out this Jetsnack application built with Compose Multiplatform for web and Kotlin/Wasm.
Set up the environment
Before starting, ensure you have the necessary IDE and browser setup to run the application.
IDE
We recommend using IntelliJ IDEA 2023.1 or later to work with the project. It supports Kotlin/Wasm out of the box.
Browser (for Kotlin/Wasm target)
To run Kotlin/Wasm applications in a browser, you need a browser supporting the Wasm Garbage Collection (GC) feature:
Chrome and Chromium-based
-
For version 119 or later:
Works by default.
Firefox
-
For version 120 or later:
Works by default.
Safari/WebKit
Wasm GC support is currently under active development.
Note: For more information about the browser versions, see the Troubleshooting documentation.
Build and run
To build and run the Jetsnack application with Compose Multiplatform for web and Kotlin/Wasm:
- In IntelliJ IDEA, open the repository.
- Navigate to the
compose-jetsnack
project folder. - Run the application by typing one of the following Gradle commands in the terminal:
-
Web version:
./gradlew :web:wasmJsRun
Once the application starts, open the following URL in your browser:
http://localhost:8080
Note: The port number can vary. If the port 8080 is unavailable, you can find the corresponding port number printed in the console after building the application.
-
Desktop version:
./gradlew :desktop:run
-
Android application:
./gradlew :android:installDebug
-
iOS application:
To setup the environment, please consult these instructions.
Feedback and questions
Give it a try and share your feedback or questions in our #compose-web Slack channel. Get a Slack invite. You can also share your comments with @bashorov on X (Twitter).