Join Slack
Powered by
Hi, I see that there's typed support for Promise o...
# javascript
e
Emmanuel Oga
01/15/2021, 4:32 AM
Hi, I see that there's typed support for Promise objects but I was wondering if there's a way to async/await promises somehow... perhaps some way to combine with coroutines? Not sure.
Emmanuel Oga
01/15/2021, 4:49 AM
ah, there seems to be some extension functions...
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/kotlin.js.-promise/await.html
Emmanuel Oga
01/15/2021, 4:49 AM
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/org.w3c.dom.-window/as-coroutine-dispatcher.html
Emmanuel Oga
01/15/2021, 4:49 AM
couldn't find an example of how to wire everything together yet.
Emmanuel Oga
01/15/2021, 4:53 AM
found this article
https://play.kotlinlang.org/hands-on/Building%20Web%20Applications%20with%20React%20and%20Kotlin%20JS/08_Using_an_External_REST_API
r
Robert Jaros
01/15/2021, 8:18 AM
you can just convert
Promise
to
Deferred
with
asDeferred()
extension function
👍 1
Open in Slack
Previous
Next