https://kotlinlang.org logo
#javascript
Title
# javascript
j

Jaime Vizan

12/01/2023, 12:06 PM
it seems there isn't an implementation of Promise.allSettled in KotlinJS. Does anyone know one alternative to execute an array of promises regardless of the result of the promise?
a

Artem Kobzar

12/01/2023, 12:09 PM
You can easily define it in your project with the
external
keyword.
Copy code
// FILE: missedApi.kt
@file:JsQualifier("Promise")

external fun allSettled(promises: Array<Promise<Any?>>): Promise<Array<String>>
@turansky can help you with it.
j

Jaime Vizan

12/01/2023, 12:14 PM
Ummmm! Good answers. Let me read more about the kotlin-wrappers. It could be enough.
K 2
Thanks a lot
t

turansky

12/01/2023, 12:43 PM
Even
Promise.withResolvers
we have 🙂
j

Jaime Vizan

12/01/2023, 3:12 PM
I have achieved to sort the problem I had out. But, I was wordering if there is some advantaje to use kotlin.js.Promise (from kotlin-sdtlib-js) against js.promise.Promise (from kotlin-wrappers). What do you think about this?
t

turansky

12/01/2023, 6:23 PM
In wrappers we use
js.promise.Promise
only
j

Jaime Vizan

12/01/2023, 7:37 PM
I have seen it, but I would like if there is some important difference between them