Is there a way to make Kotlin/JS useful (and not h...
# javascript
i
Is there a way to make Kotlin/JS useful (and not have to create wrappers for all suspend functions for example) with the IR compiler? Is there an experimental toggle/feature somehow that would make them work with
@JsExport
or generate promises out of them automatically?
t
Do you need cancellable
Promise
s? In which coroutine context
suspend
function must be called inside
Promise
?
r
I assume more concretely this means the dev wants to expose a suspend function to normal JS as part of the API of their library developed in Kotlin Multiplatform. So when the function of the library is invoked from JS, since javascript does not understand suspend it would recognise the function exposed by the library as a function with the return value of
Promise
.My company would also be interested in such a feature.
t
My company would also be interested in such a feature.
Details required
Do you need cancellable
Promise
s?
In which coroutine context
suspend
function must be called inside
Promise
?
r
I would not need them to be cancellable, I could see that as a more complete version of the feature for all cases, but it would be nice to just have the promise cover the success and error cases for the purposes of my company. As I would expose the function to the JS user, the JS user would have no way to call any suspend functions inside the promise.
👍 1