I'm trying to build a simple ktor client that I ca...
# ktor
c
I'm trying to build a simple ktor client that I can use in my JS code. But the client is coroutine heavy, and @JsExport doesn't work with coroutines. Is there a way to do this?
t
exported
suspend
method is bug.
suspend
methods - Kotlin specific (non-exportable) But in any case you need methods, which will return
Promise
instead
Could you mark
suspend
methods with
internal
(for WA)?
Do you use
IR
?
c
Yeah, using IR. So can un-suspend a suspend function by returning a Promise somehow?
j
I made in the jsMain source sets implementations of the api calls in the following way to return a promise from a suspending function: fun acceptTerms( version: String, ) = GlobalScope.promise { package.acceptTerms( httpClient, AcceptTermsRequest(version) ) }
👍 2