Class NativeCallback

  • All Implemented Interfaces:
    IsJSType

    @JsType(isNative=true,
            name="Function",
            namespace="<global>")
    public final class NativeCallback
    extends Object
    implements IsJSType
    Enables the capability to create callback directly in java script language.
    This could be helpful when for performance reason, you don't want to wraps all objects.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • create

        @JsOverlay
        public static NativeCallback create​(String code)
        Creates a callback in java script.
        All options in the configuration which can be set like scriptable, can be set with a native callback.
        The callback can receive only 1 argument, the scriptable context. The name of the argument is "context".
        Parameters:
        code - the code of the callbck to execute
        Returns:
        a callback in java script
      • create

        @JsOverlay
        public static NativeCallback create​(String argument,
                                            String code)
        Creates a callback in java script.
        All options in the configuration which can be set like scriptable, can be set with a native callback.
        The callback can receive only 1 argument, the scriptable context. The name of the argument can be set.
        Parameters:
        argument - name of the scriptable context variable to use in the java script code.
        code - the code of the callbck to execute
        Returns:
        a callback in java script
      • toSource

        @JsMethod(name="toString")
        public String toSource()
        Returns a string representing the source code of the function.
        Returns:
        a string representing the source code of the function