Hello Devs, New to GWT but I love it so far. I do have a problem that's easy to reproduce. It is a big problem for me because I want to create a GWT Module for PubNub - a utility we use internally.
I created a demo project to test out encapsulation and I have found an interesting problem with ScriptInjector. At first I followed the PubNub instructions<http://www.pubnub.com/account-javascript-api-include>. NOTE: I have included my keys for my test account. Feel free to use them. Following the instructions<http://www.pubnub.com/account-javascript-api-include>I put these two items in the html file in the GWT project (with my keys specified): <div pub-key="pub-b8b75fbd-c4cf-4583-bab9-424af7a7f755" sub-key= "sub-5e843c94-1193-11e2-bba9-b116c93082cf" ssl="off" origin= "pubsub.pubnub.com" id="pubnub"></div> <script src="http://cdn.pubnub.com/pubnub-3.1.min.js"></script> When I do this, I can use JSNI to access pubnub. It all works great. What doesn't work is if I delete the <script> tag here and inject the script instead with the following code. I know the script injects because I can see the success message and I can see the script in Developer tools in Chrome. ScriptInjector.fromUrl("http://cdn.pubnub.com/pubnub-3.1.js").setCallback( new Callback<Void, Exception>() { public void onFailure(Exception reason) { Window.alert("Script load failed."); } public void onSuccess(Void result) { Window.alert("Script load success."); } }).inject(); I feel this must be somehow related to accessing the DOM with the delayed script, or because the script is not a part of the DOM. It's trying to access the setup div and it's not able to...(just my guess) Any thoughts? I need to move the items out of the html file because I need to modularize this project for use in other larger projects. Any help would be appreciated. (PS, I have tried to create html widgets as well, and add them in EntryPoint. This also adds the <script> tag to the page based on my browsing in Developer Tools in Chrome, but it fails to work just as ScriptInjector fails.) -- 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/-/k2wmyNa2ljMJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
