Package org.teavm.jso.core
Class JSPromise<T>
java.lang.Object
org.teavm.jso.core.JSPromise<T>
- Type Parameters:
T
- The type this promise returns when resolving successfully.
- All Implemented Interfaces:
org.teavm.jso.JSObject
Interface for interacting with JavaScript
Promise
s.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface for a function wrapped by a promise.static interface
Interface for the return values of . -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> JSPromise<JSArrayReader<V>>
all
(JSArrayReader<JSPromise<V>> promises) static <V> JSPromise<JSArrayReader<JSPromise.FulfillmentValue<V>>>
allSettled
(JSArrayReader<JSPromise<V>> promises) static <V> JSPromise<V>
any
(JSArrayReader<JSPromise<V>> promises) <V> JSPromise<V>
catchError
(JSMapping<Object, V> onRejected) CallonRejected
with the reject reason, resolving with its return value.static <T> JSPromise<T>
create
(JSPromise.Executor<T> executor) Deprecated.<V> JSPromise<V>
flatCatchError
(JSMapping<Object, ? extends JSPromise<V>> onRejected) CallonRejected
with the reject reason, returning a new promise.<V> JSPromise<V>
CallonFulfilled
with the success value, returning a new promise.<V> JSPromise<V>
flatThen
(JSMapping<T, ? extends JSPromise<V>> onFulfilled, JSMapping<Object, ? extends JSPromise<V>> onRejected) CallonFulfilled
with the success value oronRejected
with the reject reason, returning a new promise.onSettled
(JSSupplier<Object> onFinally) CallonFinally
after settling, ignoring the return value.static <V> JSPromise<V>
race
(JSArrayReader<JSPromise<V>> promises) static <V> JSPromise<V>
static <V> JSPromise<V>
resolve
(V value) <V> JSPromise<V>
CallonFulfilled
with the success value, resolving with its return value.<V> JSPromise<V>
CallonFulfilled
with the success value oronRejected
with the reject reason, resolving with its return value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.teavm.jso.JSObject
cast
-
Constructor Details
-
JSPromise
-
-
Method Details
-
create
Deprecated. -
any
-
all
-
allSettled
public static <V> JSPromise<JSArrayReader<JSPromise.FulfillmentValue<V>>> allSettled(JSArrayReader<JSPromise<V>> promises) -
race
-
resolve
-
reject
-
then
CallonFulfilled
with the success value, resolving with its return value. -
then
CallonFulfilled
with the success value oronRejected
with the reject reason, resolving with its return value. -
flatThen
CallonFulfilled
with the success value, returning a new promise. -
flatThen
public <V> JSPromise<V> flatThen(JSMapping<T, ? extends JSPromise<V>> onFulfilled, JSMapping<Object, ? extends JSPromise<V>> onRejected) CallonFulfilled
with the success value oronRejected
with the reject reason, returning a new promise. -
catchError
CallonRejected
with the reject reason, resolving with its return value. -
flatCatchError
CallonRejected
with the reject reason, returning a new promise. -
onSettled
CallonFinally
after settling, ignoring the return value.
-