Promise

actual open external class Promise<out T>(source)

Exposes the JavaScript Promise object to Kotlin.

Since Kotlin

1.1
actual external class Promise<out T> : JsAny(source)

Exposes the JavaScript Promise object to Kotlin.

Since Kotlin

1.8

Constructors

Link copied to clipboard
actual constructor(executor: (resolve: (T) -> Unit, reject: (Throwable) -> Unit) -> Unit)
actual constructor(executor: (resolve: (T) -> Unit, reject: (JsAny) -> Unit) -> Unit)

Types

Link copied to clipboard
actual external object Companion
Since Kotlin 1.1
actual external object Companion
Since Kotlin 1.8

Functions

Link copied to clipboard
Link copied to clipboard
actual open external fun <S> catch(onRejected: (Throwable) -> S): Promise<S>
Since Kotlin 1.1
actual external fun <S : JsAny?> catch(onRejected: (JsAny) -> S): Promise<S>
Since Kotlin 1.8
Link copied to clipboard
actual open external fun finally(onFinally: () -> Unit): Promise<T>
Since Kotlin 1.1
actual external fun finally(onFinally: () -> Unit): Promise<T>
Since Kotlin 1.8
Link copied to clipboard
actual open external fun <S> then(onFulfilled: (T) -> S?): Promise<S>
actual open external fun <S> then(onFulfilled: (T) -> S?, onRejected: (Throwable) -> S?): Promise<S>
Since Kotlin 1.1
actual external fun <S : JsAny?> then(onFulfilled: (T) -> S?): Promise<S>
actual external fun <S : JsAny?> then(onFulfilled: (T) -> S?, onRejected: (JsAny) -> S?): Promise<S>
Since Kotlin 1.8
Link copied to clipboard
inline fun <T, S> Promise<Promise<T>>.then(noinline onFulfilled: (T) -> S?): Promise<S>
inline fun <T, S> Promise<Promise<T>>.then(noinline onFulfilled: (T) -> S?, noinline onRejected: (Throwable) -> S?): Promise<S>
Since Kotlin 1.1
Link copied to clipboard

For a Dynamic value caught in JS, returns the corresponding Throwable if it was thrown from Kotlin, or null otherwise.

Since Kotlin 1.8
Link copied to clipboard
Since Kotlin 2.2

Cast JsAny to other Js type without runtime check

Since Kotlin 1.8