Multiple GWT Apps inside one HTML Pages

302 Aufrufe
Direkt zur ersten ungelesenen Nachricht

david....@gmail.com

ungelesen,
03.07.2012, 05:50:5103.07.12
an google-we...@googlegroups.com
Hello All,

I know this question as a lot of thread in this group but I've really found what I want.
I want to compile several gwt apps independly the one from each other and load these apps into one HTML pages by inserting the <script> of each .nocache.js
I've read on gwt developper guide https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects#DevGuideModules
that this is quite a bad idea, but I've some good reason for doing so.
I've also read a post from Thomas Broyer here : http://stackoverflow.com/questions/9824763/gwt-polluting-global-javascript-namespace that said that gwt code runs inside an iframe thus is not polluting other js global ressource.

Is there really a problem of inserting several gwt apps into the same hosted html page ? Does the generated JS of one module can interfered with another generated JS ?

Thanks all for your reply

Thomas Broyer

ungelesen,
03.07.2012, 06:48:4703.07.12
an google-we...@googlegroups.com
I believe all the issues have been fixed (long ago actually).
As the docs say, there were issues with event handling, but I believe everything's fixed by now (and the doc is therefore outdated).

david....@gmail.com

ungelesen,
05.07.2012, 03:07:2805.07.12
an google-we...@googlegroups.com
Thanks Thomas,

I've already done some tests and not I've not observed any kind of troubles but my fear is that if I rebuild the apps later they entered into "collision" without warning and I don't want my application to work by mistake...
Deeper inside GWT and for my personal knowledge, can you tell me if including a GWT script into an HTML page, this one is creating an iframe DOM child in which the JS fragment are loaded thus preventing several inclusion from colliding ?

Thomas Broyer

ungelesen,
05.07.2012, 12:41:1905.07.12
an google-we...@googlegroups.com


On Thursday, July 5, 2012 9:07:28 AM UTC+2, david....@gmail.com wrote:
Thanks Thomas,

I've already done some tests and not I've not observed any kind of troubles but my fear is that if I rebuild the apps later they entered into "collision" without warning and I don't want my application to work by mistake...
Deeper inside GWT and for my personal knowledge, can you tell me if including a GWT script into an HTML page, this one is creating an iframe DOM child in which the JS fragment are loaded thus preventing several inclusion from colliding ?

Yes, that's how it works  (with the "std" and "xsiframe" linkers; with the "xs" or "sso" linker there won't be an iframe, but the risk is limited as the generated code is use the JS "module pattern" to avoid polluting the global scope –and that's why code-splitting is not supported with these linkers–; not running in an iframe though, it'll be exposed to global scope pollution by other scripts which may break it)
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten