Kotlin Wasm

Kotlin Wasm 是实验性的。 It may be changed at any time. Use it only for evaluation purposes.

We would appreciate your feedback on it in YouTrack.

WebAssembly (Wasm) is a binary instruction format for a stack-based virtual machine. This format is platform-independent because it runs on its own virtual machine. Wasm is designed to be fast and secure, and it can compile code from various programming languages, including Kotlin.

Kotlin/Wasm is a new compilation target for Kotlin. You can use it in your Kotlin Multiplatform projects. With Kotlin/Wasm, you can create applications that run on different environments and devices supporting WebAssembly and meeting Kotlin's requirements.

Learn more about Kotlin/Wasm in this YouTube video.

浏览器支持

Almost all major browsers already support WebAssembly 1.0. To run applications built with Kotlin/Wasm in a browser, you need to enable an experimental garbage collection feature.

Learn more in Get started with Kotlin/Wasm.

互操作性

Kotlin/Wasm allows you to both use JavaScript code and Browser API from Kotlin, and Kotlin code from JavaScript.

Learn more about Kotlin Wasm interoperability with JavaScript.

用于 Web 的 Compose 多平台

Web support is Experimental and may be changed at any time. Use it only for evaluation purposes. We would appreciate your feedback on it in the public Slack channel #compose-web. If you face any issues, please report them on GitHub.

Compose Multiplatform for Web is based on new Kotlin/Wasm target. You can create a Kotlin Multiplatform project and experiment with sharing your mobile or desktop UIs with the web. With Compose Multiplatform for Web, you can run your code in the browser with all the benefits of WebAssembly.

如何入门

库支持

You can use the Kotlin standard library (stdlib) and test library (kotlin.test) in Kotlin/Wasm out of the box. The version of these libraries is the same as the version of the kotlin-multiplatform plugin.

Kotlin/Wasm has an experimental support for other Kotlin libraries. Read more how to enable them in your project.

反馈