Interface JavaScript

All Known Implementing Classes:
Session

public interface JavaScript
  • Method Details

    • evaluate

      default Object evaluate(String expression)
      Evaluates JavaScript expression in global scope.
      Parameters:
      expression - JavaScript expression
      Returns:
      execution result
    • callFunction

      default void callFunction(String name)
      Calls JavaScript function.

      Function must be declared at the global (window object) scope. You can use dot notation for function name.

      Parameters:
      name - function name
    • callFunction

      default <T> T callFunction(String name, Class<T> returnType)
    • callFunction

      default <T> T callFunction(String name, Class<T> returnType, Object... arguments)
      Calls JavaScript function.

      Function must be declared at the global (window object) scope. You can use dot notation for function name.

      Parameters:
      name - function name
      returnType - return type of function
      arguments - function arguments
      Returns:
      function result
    • callPromise

      default <T, U> CompletableFuture<T> callPromise(String name, Class<T> returnType, Object... arguments)
      Calls JavaScript Promise function.

      Function must be declared at the global (window object) scope. You can use dot notation for function name.

      Parameters:
      name - function name
      returnType - return type of function
      arguments - function arguments
      Returns:
      function result
    • getVariable

      default <T> T getVariable(String name, Class<T> returnType)
      Gets JavaScript variable.

      Variable must be declared at the global (window object) scope. You can use dot notation for variable name.

      Parameters:
      name - variable name
      returnType - variable type
      Returns:
      variable value
    • setVariable

      default void setVariable(String name, Object newValue)
      Sets JavaScript variable.

      Variable must be declared at the global (window object) scope. You can use dot notation for variable name.

      Parameters:
      name - variable name
      newValue - value
    • getThis

      Session getThis()