Saturday, May 30, 2015

Re: Rescue DevMode via JavaFx and JavaPlugin?

Actually, I've been curious about this for a long time too. I finally set aside some time to try it out, and it seems like it might be a viable approach (at least, I was able to get the Hello example running).

I was able to get a "gwt plugin" working in the JavaFx WebView with < 500 lines of code. A lot of the necessary code already exists as part of the GWT unit tests, so I was able to just take a peek at how things worked over there and do a similar thing with JavaFx. There's one thing that the GWT plugin seems to do that I don't think is possible with JavaFx, which is it allows JavaScript to treat Java objects like arrays. I'm not sure if that feature is actually used anywhere, so it might not be a problem. There's also a potential issue with the fact that the JavaFx WebView uses ancient LiveScript conventions from the Netscape days for interfacing Java with JavaScript. So it's not possible to differentiate between undefined values and the string "undefined," for example. Also, it looked like JavaFx might crash if a Java exception propagates through to the JavaScript side, but I didn't bother to really dig into that to see what was going on.

Doing a cursory search, I actually wasn't able to find anything in the plugin for letting the JavaScript engine send GC information back to the server. I think the GWT UI framework was designed so that there won't really be pointers from the JS side to the Java side, so the Java side can be in charge of all the memory management (in fact, the Java side does tell the JS side when to delete JS objects). I didn't dig too deeply though. I just implemented enough to get the Hello example working.

If you're interested, I can try cleaning up the code and checking it in somewhere.

-Ming

--
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