Hi,
What's the best way to include javascript (i.e .js files) in a GWT
application?
Currently if I include in the .gwt.xml or the .html hosted page I get
an error syaing my javascript object is not defined when I try to use
it:
com.google.gwt.core.client.JavaScriptException: (TypeError):
'StreamHub' is undefined
number: -2146823279
description: 'StreamHub' is undefined
at com.streamhub.client.StreamHubGWTBridge.createStreamHub(Native
Method)
at com.streamhub.client.StreamHubGWTAdapter.<init>
(StreamHubGWTAdapter.java:54)
at com.streamhub.client.StreamHubGWTAdapter.<init>
(StreamHubGWTAdapter.java:49)
at com.streamhub.client.GWTStockTableDemo.onModuleLoad
(GWTStockTableDemo.java:19)
I create the object like the following:
public native void createStreamHub() /*-{
$wnd.gwtStreamHub = new StreamHub();
}-*/;
If I change this to:
public native void createStreamHub() /*-{
$wnd.gwtStreamHub = new $wnd.StreamHub();
}-*/;
I get a different error:
com.google.gwt.core.client.JavaScriptException: (Error): Permission
denied
number: -2146828218
description: Permission denied
at com.streamhub.client.StreamHubGWTBridge.subscribe(Native Method)
at com.streamhub.client.StreamHubGWTAdapter.subscribe
(StreamHubGWTAdapter.java:91)
at com.streamhub.client.GWTStockTableDemo.addStocks
(GWTStockTableDemo.java:42)
at com.streamhub.client.GWTStockTableDemo.onModuleLoad
(GWTStockTableDemo.java:21)
I think the problem stems from the fact that the GWT code runs in an
iframe and the included JavaScript is included in the parent page.
How can I include the javascript in the same iframe as the GWT code
runs?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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
-~----------~----~----~----~------~----~------~--~---