public interface JS
This interface defines provides the main API for executing JavaScript code on a client.
-
Method Summary
Modifier and TypeMethodDescriptionExecutes the given JavaScript code synchronously on the client.Executes the given code in the javascript client.evalFuture
(String code) Executes the given code in the javascript client.
-
Method Details
-
eval
Executes the given JavaScript code synchronously on the client. The method returns aJSVariable
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
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
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
-