Promise

@native @JSType trait Promise[T] extends StObject

Represents the completion of an asynchronous operation

trait StObject
class Object
trait Any
class Object
trait Matchable
class Any
class Promise[T]

Value members

Concrete methods

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.

def `catch`[TResult](onrejected: Function1[Any, TResult | Thenable[TResult]]): Promise[T | TResult]
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).

def `finally`(onfinally: Function0[Unit]): Promise[T]
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.

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

Inherited methods

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

Concrete fields

@JSName
val toStringTag: String