Skip to content Skip to sidebar Skip to footer

Jsinterop Wrapping A Javascript Function Property

I am working with GWT 2.8, and I am working on a wrapper for a javascript library. One of the properties of a javascript class I am trying to wrap is a function. I would like the

Solution 1:

As Adam said (and explained in more detail in the other post), you can expose a @JsProperty with a @JsFunction type.

@JsType(isNative=true) publicclassFoo {
    @JsFunctionpublicstaticinterfaceBarFn {
        Objectinvoke(Object... args);
    }
    @JsPropertypublicBarFn bar;
}

My recommendation to learn JsInterop is to explore other projects like: OpenLayers JsInterop wrapper, Elemental2 source code, or explore github. Elemental2 has the whole browser API so there are plety of examples, it is a really good place to find examples. JsInterop documentation here.

Post a Comment for "Jsinterop Wrapping A Javascript Function Property"