Tuesday, July 22, 2014

Re: GWT JS Interopt

On Tuesday, July 22, 2014 6:02:44 AM UTC+2, 田传武 wrote:
Maybe the same issue as:

BTW, how do you use gwt-maven-plugin to pass the compile option "-XjsInteropMode JS"?

I just patched CompileMojo.java (part of the gwt-maven-plugin) directly as no option existed for it. 

By the way, any idea why that option isn't default set to JS?  It's rather annoying and it looks like I will have to patch and compile gwt itself for DevMode to support it. 

A bonus issue, I saw you did not use addEventListener like the demo does, and I really struggled to make it work.  The generated javascript looks like "addEventListener('click', new xxx(this))" which doesn't work (the key thing here being "new" I'd guess).  I found no other way to call it directly and eventually resorted to doing it from a jsni function instead:
        public static native void jsAddEventListener(Element elem, String event, EventListener listener) /*-{
elem.addEventListener(event, function(ev) { listener.onEvent(ev); });
        }-*/;

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment