Hey, Kotlin coroutines for Wasm/JS support JS promises. How do they work internally? For example, when Kotlin imports a JS function that returns a promise, how does the Wasm module get notified when the promise is resolved on the JS side? Also how is a promise represented as a native Wasm type when passed from JS to Kotlin initially?
Asking in the context of implementing a similar feature for the WasmWasi target. The coroutines library supports the target, and theoretically, it should be possible to implement a feature similar to the interop with JS promises for the browser. For instance, on the host side there could be some sort of Future.