gwt - JsInterop wrapping a javascript function property -


i working gwt 2.8, , working on wrapper javascript library.

one of properties of javascript class trying wrap function. wrapper work closely possible native javascript. how go wrapping jsproperty javascript function?

details: javascript class has property function called when specific event triggered. able write labmda function in java, , assign property, run in javascript.

as adam said (and explained in more detail in other post), can expose @jsproperty @jsfunction type.

@jstype(isnative=true) public class foo {     @jsfunction public static interface barfn {         object invoke(object... args);     }     @jsproperty public barfn bar; } 

my recommendation learn jsinterop explore other projects like: openlayers jsinterop wrapper, elemental2 source code, or explore github. elemental2 has whole browser api there plety of examples, place find examples. jsinterop documentation here.


Comments