julien lengrand-lambert
03/30/2022, 2:14 PMasync functions into Kotlin, some pointers would be greatly appreciated because I'm early missing something (https://stackoverflow.com/questions/71678834/how-do-i-import-and-use-an-async-js-function-in-kotlin-js)shaktiman_droid
03/30/2022, 2:31 PMsuspend keyword won't work in external declaration. I think you want SignUp function to return a Promise<String>
external object are considered as pure JS objects and JS doesn't have suspend.julien lengrand-lambert
03/30/2022, 2:32 PMjulien lengrand-lambert
03/30/2022, 2:32 PMBig Chungus
03/30/2022, 2:32 PMasync in JS is just a syntactic sugar for a function returning Promise to unwrap it to callbacks. So async function myFun(): Promise<String> would be represented in kotlin as external fun myFun(): kotlin.js.Promise<String>
From there, you can use coroutines runtime lib utilities to convert the promises to suspend scopes and other coroutine builders.julien lengrand-lambert
03/30/2022, 2:39 PM.await() in my coroutine. But somehow I can't unpack the object so I'm wondering if it's translated correctlyjulien lengrand-lambert
03/30/2022, 2:46 PMshaktiman_droid
03/30/2022, 2:48 PMsuspend and return a Promise would not make sense. suspend might not be doing anything since you are using await inside coroutineBig Chungus
03/30/2022, 3:16 PMjulien lengrand-lambert
03/30/2022, 3:26 PMjulien lengrand-lambert
03/30/2022, 3:26 PMBig Chungus
03/30/2022, 3:36 PMJulius
04/01/2022, 12:24 PMBig Chungus
04/01/2022, 3:53 PMJulius
04/01/2022, 4:00 PM