Skip to content

JSPromise structure

Represents a JavaScript Promise object.

C#
public struct JSPromise : IJSValue<JSPromise>

Public Members

namedescription
JSPromise(…)Creates a new JS Promise with a resolve callback. (4 constructors)
static All(…)(3 methods)
static Any(…)(3 methods)
static Race(…)(3 methods)
static Reject(…)Creates a new promise that is rejected with the provided reason.
static Resolve()Creates a new promise that resolves to a value of undefined.
static Resolve(…)Creates a new promise that resolves to the provided value.
As<T>()Tries to create a T struct from this instance. It returns null if the T struct cannot be created.
AsUnchecked<T>()Creates a T struct from this instance without checking the enclosed handle type. It must be used only when the handle type is known to be correct.
CastTo<T>()Creates a T struct from this instance. It throws InvalidCastException in case of failure.
Catch(…)Registers a callback that is invoked when a promise is rejected, and returns a new chained promise.
Equals(…)Compares two JS values using JS "strict" equality.
override Equals(…)
Finally(…)Registers a callback that is invoked after a promise is fulfilled or rejected, and returns a new chained promise.
override GetHashCode()
Is<T>()Checks if the T struct can be created from this instance`.
Then(…)Registers callbacks that are invoked when a promise is fulfilled and/or rejected, and returns a new chained promise.
operator ==Compares two JS values using JS "strict" equality.
explicit operatorExplicitly converts a JSValue to a nullable JSPromise. (3 operators)
implicit operatorImplicitly converts a JSPromise to a JSValue. (2 operators)
operator !=Compares two JS values using JS "strict" equality.
delegate AsyncResolveCallback
delegate AsyncResolveRejectCallback
struct DeferredSupports resolving or rejecting a created JavaScript Promise.
delegate ResolveCallback
delegate ResolveRejectCallback

See Also

Released under the MIT license