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
Promises.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for a function wrapped by a promise.static interfaceInterface for the return values ofallSettled(JsArrayReader). -
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) CallonRejectedwith 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) CallonRejectedwith the reject reason, returning a new promise.<V> JSPromise<V> CallonFulfilledwith the success value, returning a new promise.<V> JSPromise<V> flatThen(JSMapping<T, ? extends JSPromise<V>> onFulfilled, JSMapping<Object, ? extends JSPromise<V>> onRejected) CallonFulfilledwith the success value oronRejectedwith the reject reason, returning a new promise.onSettled(JSSupplier<Object> onFinally) CallonFinallyafter 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> CallonFulfilledwith the success value, resolving with its return value.<V> JSPromise<V> CallonFulfilledwith the success value oronRejectedwith 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, waitMethods 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
CallonFulfilledwith the success value, resolving with its return value. -
then
CallonFulfilledwith the success value oronRejectedwith the reject reason, resolving with its return value. -
flatThen
CallonFulfilledwith 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) CallonFulfilledwith the success value oronRejectedwith the reject reason, returning a new promise. -
catchError
CallonRejectedwith the reject reason, resolving with its return value. -
flatCatchError
CallonRejectedwith the reject reason, returning a new promise. -
onSettled
CallonFinallyafter settling, ignoring the return value.
-