Class PromiseOutcome

All Implemented Interfaces:
HasHandlers

public class PromiseOutcome extends DataClass
Holds information about the outcome of a settled Promise.

Note: This is the type of object returned by Promise.allSettled().

  • Constructor Details

    • PromiseOutcome

      public PromiseOutcome()
    • PromiseOutcome

      public PromiseOutcome(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static PromiseOutcome getOrCreateRef(JavaScriptObject jsObj)
    • setReason

      public PromiseOutcome setReason(Object reason)
      Only if the status is REJECTED, the reason that the Promise rejected with.
      Parameters:
      reason - New reason value. Default value is *initialized by the implementation*
      Returns:
      PromiseOutcome instance, for chaining setter calls
    • getReason

      public Object getReason()
      Only if the status is REJECTED, the reason that the Promise rejected with.
      Returns:
      Current reason value. Default value is *initialized by the implementation*
    • setStatus

      public PromiseOutcome setStatus(SettledPromiseStatus status)
      The state that the Promise settled into.
      Parameters:
      status - New status value. Default value is *initialized by the implementation*
      Returns:
      PromiseOutcome instance, for chaining setter calls
    • getStatus

      public SettledPromiseStatus getStatus()
      The state that the Promise settled into.
      Returns:
      Current status value. Default value is *initialized by the implementation*
    • setValue

      public PromiseOutcome setValue(Object value)
      Only if the status is FULFILLED, the value that the Promise fulfilled with.
      Parameters:
      value - New value value. Default value is *initialized by the implementation*
      Returns:
      PromiseOutcome instance, for chaining setter calls
    • getValue

      public Object getValue()
      Only if the status is FULFILLED, the value that the Promise fulfilled with.
      Returns:
      Current value value. Default value is *initialized by the implementation*