Promise

JS
1.1
open class Promise<out T>
(source)

Exposes the JavaScript Promise object to Kotlin.

Constructors

JS
1.1

<init>

Exposes the JavaScript Promise object to Kotlin.

Promise(
    executor: (resolve: (T) -> Unit, reject: (Throwable) -> Unit) -> Unit)

Functions

JS
1.1

catch

open fun <S> catch(onRejected: (Throwable) -> S): Promise<S>
JS
1.1

finally

open fun finally(onFinally: () -> Unit): Promise<T>
JS
1.1

then

open fun <S> then(onFulfilled: ((T) -> S)?): Promise<S>
open fun <S> then(
    onFulfilled: ((T) -> S)?,
    onRejected: ((Throwable) -> S)?
): Promise<S>

Companion Object Functions

JS
1.1

all

fun <S> all(
    promise: Array<out Promise<S>>
): Promise<Array<out S>>
JS
1.1

race

fun <S> race(promise: Array<out Promise<S>>): Promise<S>
JS
1.1

reject

fun reject(e: Throwable): Promise<Nothing>
JS
1.1

resolve

fun <S> resolve(e: S): Promise<S>
fun <S> resolve(e: Promise<S>): Promise<S>

Extension Functions

JS
1.1

then

fun <T, S> Promise<Promise<T>>.then(
    onFulfilled: ((T) -> S)?
): Promise<S>
fun <T, S> Promise<Promise<T>>.then(
    onFulfilled: ((T) -> S)?,
    onRejected: ((Throwable) -> S)?
): Promise<S>