Class PromiseStatus<F, R>

A class which represents the outcome of an action which can either succeed or fail. See httpFetch for an example on how it can be used.

Type Parameters

  • F
  • R

Methods

  • Execute a callback only if the promiseStatus was rejected.

    Parameters

    • catchFn: ((rejected) => void)
        • (rejected): void
        • Parameters

          • rejected: R

          Returns void

    Returns PromiseStatus<F, R>

    the PromiseStatus instance for method chaining

  • Check whether this promise is fulfilled. When true use unwrap to access the fulfilled class.

    Returns bool

  • Check whether this promise is rejected. When true use unwrapRejected to access the rejected class.

    Returns bool

  • Execute a callback only if the promiseStatus was fulfilled.

    Parameters

    • thenFn: ((fulfilled) => void)
        • (fulfilled): void
        • Parameters

          • fulfilled: F

          Returns void

    Returns PromiseStatus<F, R>

    the PromiseStatus instance for method chaining

  • Access the fulfilled data serialised into the class set as the fulfilled class. Check isFulfilled before calling this method.

    Returns F

    Throws

    when unwrapping a rejected Promise

  • Access the rejected data serialised into the class set as the rejected class. Check isRejected before calling this method.

    Returns R

    Throws

    when unwrapping a fulfilled Promise