Hi guys i am making as project in KMP with wasm al...
# webassembly
b
Hi guys i am making as project in KMP with wasm also as an target, how would i do an api call in wasm target ts there any engine there for wasm target as android and ios has darwin and all do wasm also has an engine?
s
Hi! Wasm in KMP has two different targets
wasmJs
and
wasmWasi
with different sets of APIs. In
wasmJs
you have browser APIs. Some of them are provided in package org.w3c, in standard library. You can access missing APIs using general interoperability with JS. In
wasmWasi
target currently can access WASI Preview 1 APIs. We don’t provide ready-to-use WASI sys-calls yet, but you can see how they are implemented in KoWasm project here. WASI as a standard, is in the early stage of development, and the upcoming WASI Preview 2 API set will completely replace all Preview 1 APIs.
b
no i meant i am using ktor for sharing code and ktor client to do network calls so i am thinking is there any way i can share the code of network calls in target wasmJs
as we have to make HttpClient an expect class so how would i give it an actual in wasmjs instead of darwin in ios and andoid client fro android should i use js client ?
s
Oh, I indeed have misunderstood your question. I was thinking about the Wasm analogue of Android and Darwin operating system APIs. Ktor support for Wasm target is not finished (Github PR). I don’t know all the details, but I would assume it will have an engine, similar to other targets.
b
@Svyatoslav Kuzmich [JB] ok thanks, so i cant use wasm with my shared code now 😨
c
b
@christianbecker great ill try to use it well are there any issues anyone faced ?
m
No issue directly related to WASM but 3.0.0 breaks my desktop app. Under certain circumstances, which I have not yet fully investigate, I do not get any response from the server anymore. So be warned. It’s a 00 release 😉.
😨 1
b
@christianbecker its not there now idk if they have removed it or not but it is not there
c
@Bharat Kumar You might have to add that extra Maven repository: https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental/io/ktor/ktor-client-js/3.0.0-wasm2/
b
@christianbecker okk thanks
130 Views