I have been testing JsInterop for a while, and is very promising ... The issue of static functions is something I have asked, and we have to wait Java support 8 and the new JSNI too. @confile, if you want to look at a couple of projects on which I am working:
- gwt-jscore <https://github.com/workingflows/gwt-jscore> - gwt-jquery <https://github.com/workingflows/gwt-jquery> - gwt-playground <https://github.com/csrinaldi/samples-of-gwt/tree/master/gwt-playground> probably when Elemental 2.0 has been implemented, gwt-jscore will not be necessary. gwt-used-playgroud use jscore and a simple implementation of gwt-jquery, with suport of Event and Promise... For create object I use for the moment a Factory Class, and for emulate static method, by example, Object.observe, I have a two interface, see: JS Factory Class <https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/JS.java> and Browser Factory Class <https://github.com/workingflows/gwt-jscore/blob/master/src/main/java/com/workingflows/js/jscore/client/factory/Browser.java>, if not the best solution, but until this all implemented works for me. Hope you helps. El sábado, 4 de octubre de 2014 12:18:08 UTC-3, confile escribió: > > Consider the following static JavaScript function: > > THREE.ImageUtils = { > loadTexture: function (url) { ... } > > } > > The way I use to create the static function with JsInterop is to create an > interface for ImageUtils and then create an inner abstract class MyStatic > which contains the static methods implemented with JSNI. > > Here is an example of the above class: > > @JsType > public interface ImageUtils { > > public static abstract class MyStatic { > > public static native Texture create(String url) /*-{ > return new $wnd.THREE.ImageUtils.loadTexture(url); > }-*/; > } > > } > > > I don't think this is the best solution. Is there a better way to handle > static functions with JsInterop? > > -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/c8c8404e-addb-43e6-8560-b2a48cfca93e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
