Promise

@JSGlobal("Promise") @native @JSType class Promise[T] extends StObject with Promise[T]
Companion
object
trait Promise[T]
trait StObject
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Constructors

def this(executor: Function2[Function1[T | Thenable[T], Unit], Function1[UndefOr[Any], Unit], Unit])

Creates a new Promise.

Creates a new Promise.

Value Params
executor

A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

Inherited methods

def `catch`[TResult](onrejected: Function1[Any, TResult | Thenable[TResult]]): Promise[T | TResult]
Inherited from
Promise
def `catch`[TResult](): Promise[T | TResult]

Attaches a callback for only the rejection of the Promise.

Attaches a callback for only the rejection of the Promise.

Value Params
onrejected

The callback to execute when the Promise is rejected.

Inherited from
Promise
def `finally`(onfinally: Function0[Unit]): Promise[T]
Inherited from
Promise
def `finally`(): Promise[T]

Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

Value Params
onfinally

The callback to execute when the Promise is settled (fulfilled or rejected).

Inherited from
Promise
def `then`[TResult1, TResult2](onfulfilled: Unit, onrejected: Function1[Any, TResult2 | Thenable[TResult2]]): Promise[TResult1 | TResult2]
Inherited from
Promise
def `then`[TResult1, TResult2](onfulfilled: Null, onrejected: Function1[Any, TResult2 | Thenable[TResult2]]): Promise[TResult1 | TResult2]
Inherited from
Promise
def `then`[TResult1, TResult2](onfulfilled: Function1[T, TResult1 | Thenable[TResult1]], onrejected: Function1[Any, TResult2 | Thenable[TResult2]]): Promise[TResult1 | TResult2]
Inherited from
Promise
def `then`[TResult1, TResult2](onfulfilled: Function1[T, TResult1 | Thenable[TResult1]]): Promise[TResult1 | TResult2]
Inherited from
Promise
def `then`[TResult1, TResult2](): Promise[TResult1 | TResult2]

Attaches callbacks for the resolution and/or rejection of the Promise.

Attaches callbacks for the resolution and/or rejection of the Promise.

Value Params
onfulfilled

The callback to execute when the Promise is resolved.

onrejected

The callback to execute when the Promise is rejected.

Inherited from
Promise
def hasOwnProperty(v: String): Boolean
Inherited from
Object
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def toLocaleString(): String
Inherited from
Object
def valueOf(): Any
Inherited from
Object

Inherited fields

@JSName
val toStringTag: String
Inherited from
Promise