Tuesday, November 29, 2011

Re: GWT compiler question(s)

There's no magic: http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#DevGuideDevMode

JSNI code (which obviously includes everything manipulating the DOM) is sent to the browser (from the DevMode java app –a.k.a. "code server"– to the Dev Plugin running in your browser) to be evaluated (as JavaScript), the browser then keeps references to these functions to call them later.
Every time your code calls one such JSNI method, the DevMode java app asks the browser Dev plugin to call the function; the result is sent back to the DevMode java app.
Similarly, when you call Java methods from your JSNI, or when there's an even in the browser that has to be routed to Java code, the Dev browser plugin asks the DevMode to run the code in Java; and he result is sent back to the Dev browser plugin.
JS objects ("extends JavaScriptObject") are kept in the browser and assigned a "client ID"; the DevMode java app only knows about their "client ID". Similarly, Java objects (most of your code) is kept on the Java side and the browser only sees "opaque" objects with a "server ID" assigned by the DevMode java app.
That way, JS code is run in the browser, and subject to browser bugs and features, and Java code runs in Java.

And what's great is that you can run the DevMode "code server" on one machine and the browser with the Dev plugin on another one, or within a VM; this allows to develop in, say, Linux, and test in DevMode in IE (on another machine or in VirtualBox).
AFAICT, the GWT team runs all the GWT unit tests in a bunch of browsers (Firefox, Safari, IE6/7/8/9, etc. on Linux, MacOSX, Windows; I don't exactly) using this "remote testing" recipe; automatically as part of their continuous build.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/NnGTSupjGoEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment