Package com.vaadin.flow.dom
Interface Element.CallFunctionJs
- All Superinterfaces:
Serializable
- Enclosing class:
Element
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 TypeMethodDescriptioncallFunction(String functionName, Object... arguments) Calls the named function on the element, with the element asthisof a plain name and the property it is read from asthisof 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 asthisof a plain name and the property it is read from asthisof 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 propertyarguments- the arguments to pass to the function- Returns:
- the pending result of the call, which answers with what the function returned
-