Promise

open external class Promise<out T>(executor: (resolve: (T) -> Unit, reject: (Throwable) -> Unit) -> Unit)

Exposes the JavaScript Promise object to Kotlin.

Constructors

Promise
Link copied to clipboard
fun <out T> Promise(executor: (resolve: (T) -> Unit, reject: (Throwable) -> Unit) -> Unit)

Types

Companion
Link copied to clipboard
object Companion

Functions

catch
Link copied to clipboard
open fun <S> catch(onRejected: (Throwable) -> S): Promise<S>
then
Link copied to clipboard
open fun <S> then(onFulfilled: (T) -> S?): Promise<S>
open fun <S> then(onFulfilled: (T) -> S?, onRejected: (Throwable) -> S?): Promise<S>

Extensions

then
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>