Interface Thenable

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Thenable
    Default interface for thenable objects. By implementing this interface Java objects can be used with JavaScript async/await.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void then​(org.graalvm.polyglot.Value onResolve, org.graalvm.polyglot.Value onReject)  
    • Method Detail

      • then

        void then​(org.graalvm.polyglot.Value onResolve,
                  org.graalvm.polyglot.Value onReject)
        Parameters:
        onResolve - - A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value. If it is not a function, it is internally replaced with an "Identity" function (it returns the received argument).
        onReject - - A Function called if the Promise is rejected. This function has one argument, the rejection reason. If it is not a function, it is internally replaced with a "Thrower" function (it throws an error it received as argument).