Package com.vaadin.client.flow.util
Class NativeFunction
- java.lang.Object
-
- com.vaadin.client.flow.util.NativeFunction
-
@JsType(isNative=true, name="Function", namespace="<global>") public class NativeFunction extends ObjectJsInterop wrapper for interacting with the JavaScript Function type.- Since:
- 1.0
- Author:
- Vaadin Ltd
-
-
Constructor Summary
Constructors Constructor Description NativeFunction(String... paramsAndCode)Creates a new function with the given parameters and implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectapply(Object thisArg, JsArray<?> arguments)Invokes this function with a giventhisand arguments provided as an array.Objectcall(Object thisArg, Object... arguments)Invokes this function with a giventhisand arguments provides as varargs.static <T> Tcreate(String... paramsAndCode)Creates a new function with the given parameters and implementation.
-
-
-
Constructor Detail
-
NativeFunction
public NativeFunction(String... paramsAndCode)
Creates a new function with the given parameters and implementation.- Parameters:
paramsAndCode- parameter names followed by the code of the function
-
-
Method Detail
-
apply
public Object apply(Object thisArg, JsArray<?> arguments)
Invokes this function with a giventhisand arguments provided as an array.- Parameters:
thisArg- the value ofthisarguments- an array of arguments- Returns:
- the return value of the invocation
-
call
public Object call(Object thisArg, Object... arguments)
Invokes this function with a giventhisand arguments provides as varargs.- Parameters:
thisArg- the value ofthisarguments- the arguments to invoke this function with- Returns:
- the return value of the invocation
-
create
@JsOverlay public static <T> T create(String... paramsAndCode)
Creates a new function with the given parameters and implementation. The return value of this method is intended to be used as a type annotated with@JsFunction.- Type Parameters:
T- the function type- Parameters:
paramsAndCode- parameter names followed by the code of the function- Returns:
- the native function
-
-