Module jpro.webapi

Interface JS


public interface JS
This interface defines provides the main API for executing JavaScript code on a client.
  • Method Details

    • eval

      JSVariable eval(String code)
      Executes the given JavaScript code synchronously on the client. The method returns a JSVariable that represents the result of the executed code.
      Parameters:
      code - the JavaScript code to be executed
      Returns:
      a JSVariable representing the result of the code execution
    • evalAsync

      PromiseJSVariable evalAsync(String code)
      Executes the given code in the javascript client. The code must be asynchronous and end with a return statement.
      Parameters:
      code - the asynchronous JavaScript code to be executed
      Returns:
      a PromiseJSVariable representing the result of the asynchronous code execution
    • evalFuture

      CompletableFuture<JSVariable> evalFuture(String code)
      Executes the given code in the javascript client. The code must be asynchronous and end with a return statement.
      Parameters:
      code - the JavaScript code to be executed
      Returns:
      a CompletableFuture<JSVariable> that will be completed with the result of the code execution