public interface ClientScriptOperation
Modifier and Type | Field and Description |
---|---|
static OperationType<ClientScriptOperation> |
TYPE
Operation type providing means to execute JavaScript on the client-side.
|
Modifier and Type | Method and Description |
---|---|
Serializable |
perform(String script,
boolean asynchronous)
Executes JavaScript code on the client-side, while waiting for its completion.
|
static final OperationType<ClientScriptOperation> TYPE
@Nullable Serializable perform(String script, boolean asynchronous)
// function scriptMethod() { // return 'methodReturnValue'; // } final Serializable returnValue = operation.perform(script, false); // returnValue => "methodReturnValue"
// true ? 'methodReturnValue' : 'nothing' final Serializable returnValue = operation.perform(script, false); // returnValue => "methodReturnValue"
// function scriptMethod() { // return 'methodReturnValue'; // } // scriptMethod(); final Serializable returnValue = operation.perform(script, false); // returnValue => "methodReturnValue"Asynchronous script execution:
// function scriptMethod(callback) { // var dialog = createRequestDialog(); // dialog.on('close', function() { // callback('methodReturnValue'); // }); // dialog.show(); // } final Serializable returnValue = operation.perform(script, true); // returnValue => "methodReturnValue"Important:
script
- The JavaScript code to be executed on the client-side.asynchronous
- true
if the JavaScript code should be executed asynchronously
using a callback function, false
if the script should be executed
and the evaluated return value should be returned.null
if there is no value to return.Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210