await

suspend fun <T> Promise<T>.await(): T(source)

Awaits for completion of the promise without blocking.

This suspending function is cancellable: if the Job of the current coroutine is cancelled while this suspending function is waiting on the promise, this function immediately resumes with CancellationException. There is a prompt cancellation guarantee: even if this function is ready to return the result, but was cancelled while suspended, CancellationException will be thrown. See suspendCancellableCoroutine for low-level details.

suspend fun <T> Promise<JsAny?>.await(): T(source)

Awaits for completion of the promise without blocking.

This suspending function is cancellable: if the Job of the current coroutine is cancelled while this suspending function is waiting on the promise, this function immediately resumes with CancellationException. There is a prompt cancellation guarantee: even if this function is ready to return the result, but was cancelled while suspended, CancellationException will be thrown. See suspendCancellableCoroutine for low-level details.