Saturday, November 24, 2018

Re: First application working as both J2CL and gwt2 at the same time


On Saturday, November 24, 2018 at 8:21:58 PM UTC+1, Vassilis Virvilis wrote:
Thanks for posting this.

Not sure if I read this correctly.

Assuming all other being equal (can't really be sure):

 GWT:  Loading of *.cache.js takes 433ms for 75.8KB - there is also app.nocache.js 95ms for 3.3KB
 J2CL: Loading of app.js takes 490ms for 70.5KB

The difference in timing is of course a network artifact since j2cl has less code to transmit.

Does j2cl has something equivalent of *.nocache.js. How it is linked? Does it use an iframe as GWT or is directly loaded in the document window?

J2Cl is only a Java to JS transpiler. JS compilation is done by the Closure Compiler. There's no notion of "permutation" (or, more accurately, it's a manual task, generating separate scripts, with no built-in equivalent to a selection script –GWT's *.nocache.js; btw even for GWT, Google uses server-side selection, have a look at the HTML source of Google Groups for an example).
In the case of this app, the code is loaded directly into the document; the "linker" is kind of a "hack", based on Colin's preliminary work to build a "devmode" (https://github.com/niloc132/j2cl/tree/app-building-tools) and an additional script to run the onModuleLoad (https://github.com/DominoKit/dominodo/blob/547699f501d0a85361827839f7cf005da82159d3/dominodo/dominodo-j2cl/src/main/java/org/dominokit/samples/App.native.js)

I could see a lot of GWT programs breaking if the link model changes...

J2Cl != GWT3

"Linkage" is part of the things that still need to be done for GWT3: how to handle permutations with the Closure Compiler? How about code splitting?
For apps that don't need i18n and/or code splitting, J2Cl + Closure Compiler (and the various J2Cl-compatible libs that are being developed now), and a simple "bootstrap script" (to create the entry point and call its onModuleLoad), should "just work".

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment