Interface Element.CallFunctionJs

All Superinterfaces:
Serializable
Enclosing class:
Element

@JsDefinition public static interface Element.CallFunctionJs extends Serializable
The JavaScript behind Element.callJsFunction(String, Object...), as a JavaScript definition for Element.executeJs(Class).

One declaration serves every call, whatever the function is called and however many arguments it takes, so the bundle carries a single function for all of them and the browser is sent the name and the arguments of a call rather than JavaScript that names the function.

Since:
25.4
  • Method Summary

    Modifier and Type
    Method
    Description
    callFunction(String functionName, Object... arguments)
    Calls the named function on the element, with the element as this of a plain name and the property it is read from as this of a dotted one, which is how a function reached through a property is called in JavaScript.
  • Method Details

    • callFunction

      @JsExpression("const path = $0.split(\'.\');\nconst name = path.pop();\nlet target = this;\nfor (const step of path) {\n target = target[step];\n}\nreturn target[name](...$1);\n") PendingJavaScriptResult callFunction(String functionName, Object... arguments)
      Calls the named function on the element, with the element as this of a plain name and the property it is read from as this of a dotted one, which is how a function reached through a property is called in JavaScript.
      Parameters:
      functionName - the name of the function to call, which may contain dots to name a function on a property
      arguments - the arguments to pass to the function
      Returns:
      the pending result of the call, which answers with what the function returned