Update:
Il giorno giovedì 17 settembre 2015 09:18:34 UTC+2, Cristiano ha scritto:
-- with the sso linker the project responds as expected: the GWT code is available as soon as page has loaded
You could check it out on this branch:
https://github.com/cristcost/jspoc/tree/test_with_sso
note that:
- with sso linker super dev mode don't work (I've worked manually compiling javascript and testing the compiled code directly)
- sso works only if you have exactly one permutation, and to obtain exactly 1 permutation I've removed inheritance of 'com.google.gwt.user.User' module (in fact your example was not using anything from that module)
Il giorno giovedì 17 settembre 2015 09:18:34 UTC+2, Cristiano ha scritto:
Hi Brian,I had problems similar to you when studying JsInterop, so I've tried your code.I've forked your repo (see https://github.com/cristcost/jspoc ) and I have made it work but with some considerations to take into account.Other than the problems on using JsInterop annotations as reported by Jens, I've found a script load timing issue:you execute the the Javascript code in the main page script, but at that point GWT has not yet loaded!Putting the execution of your javascript code inside window.onload event is not again enough: I think this is because of using the xsiframe linker (I'm curious to try out with the sso linker).So I have used a 3 seconds timeout...In the fork I've added some console logging to outline the time each part of the Javascript is executed, and the order is:- first javascript inside main html page is executed- then javascript inside the window.onload- finally the GWT entry pointYour javascript code, with the fixes suggested by Jens, has worked after a 3 seconds timeout.Of course I don't like this workaround, but a more general approach could be to have your application started from the GWT entry point (i.e. define a "main" function in javascript, then run it from GWT entry point). If you don't like the ping-pong between JS and GWT, you may try different solution to detect when GWT has loaded, or - if the problem is the xsiframe linker - try another linker.Please note that I've changed totally the pom.xml and copied configuration from one of mines: in particular I have added a configuration for maven-jetty-plugin,so to try it out you need can execute the following commands:
After this you should be able to open your browser at http://localhost:8888/ and you should see the alert popup (but 3 seconds after the page load!)Hope this is helpful,CristianoPS. I'm using gwt 2.8.0-SNAPSHOT and also gwt-maven-plugin 2.8.0-SNAPSHOT that I have compiled personally, so I don't have added the repo on the pom.xml,you should re-add it from your pom.xml or compile the two by yourself. The gwt-maven-plugin 2.8.0-SNAPSHOT is available at https://github.com/gwt-maven-plugin/gwt-maven-plugin and I compile it skipping the tests with
mvn clean install -DskipTests
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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment