var pingTime = 10000;
and later <div id="widget"></div> - where my widget is inserted.
I tried the following:
public native int getPingTime() /*-{
return pingTime;
}-*/;
but it failes with expection:
[ERROR] Unable to load module entry point class
com.alcea.mitesite.chat.client.MiteSiteChatDemo
java.lang.RuntimeException: JavaScript method
'@com.alcea.mitesite.chat.client.MiteSiteChat::getPingTime()' threw an
exception
<snip!>
Caused by: com.google.gwt.core.client.JavaScriptException: JavaScript
TypeError exception: 'pingTime' is undefined
<snip!>
any ideas?
(unnabridged exception trace below)
Geoff
[ERROR] Unable to load module entry point class
com.alcea.mitesite.chat.client.MiteSiteChatDemo
java.lang.RuntimeException: JavaScript method
'@com.alcea.mitesite.chat.client.MiteSiteChat::getPingTime()' threw an
exception
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:365)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeInt(ModuleSpaceIE6.java:176)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:87)
at
com.alcea.mitesite.chat.client.MiteSiteChat.getPingTime(MiteSiteChat.java:143)
at
com.alcea.mitesite.chat.client.MiteSiteChat.start(MiteSiteChat.java:78)
at
com.alcea.mitesite.chat.client.MiteSiteChatDemo.onModuleLoad(MiteSiteChatDemo.java:31)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:64)
Caused by: com.google.gwt.core.client.JavaScriptException: JavaScript
TypeError exception: 'pingTime' is undefined
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at
com.google.gwt.dev.shell.ModuleSpace.createJavaScriptException(ModuleSpace.java:267)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.exceptionCaught(ModuleSpaceIE6.java:76)
at
com.google.gwt.dev.shell.JavaScriptHost.exceptionCaught(JavaScriptHost.java:31)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.dev.shell.StaticJavaDispatch.callMethod(StaticJavaDispatch.java:45)
I don't know the anwser, but I can give you a tip. Compile with -PRETTY
and open the main page from /www in Firefox and use the Venkman
debugger to see what is what. If you open Venkman before loading the
page it will break on the exception.
-= Mat
window.pingTime = 10000;
and the method to
private native int getPingTime() /*-{
return $wnd.pingTime;
}-*/;
and I get a new exception:
[ERROR] Unable to load module entry point class
com.alcea.mitesite.chat.client.MiteSiteChatDemo
java.lang.RuntimeException: JavaScript method
'@com.alcea.mitesite.chat.client.MiteSiteChat::getPingTime()' returned
'undefined'. This can happen either because of a missing return
statement, or explicitly returning a value of 'undefined' (e.g. 'return
element[nonexistent property]')
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:342)
Which raises another question for another topic.
Thanks for the help!
Geoff