I want to use goJS with GWT. I downloaded GOJS javascript and put it in the sampleproject folder under war where sampleproject.nocache.js and sampleproject.devmode.js is present. In sampleproject.html i added
<script type="text/javascript" language="javascript" src="sampleproject/go.js">
</script>
In one of the view i used
public static native void initGo() /*-{
var $$ = go.GraphObject.make;
}-*/;
when i call this function , exception is thrown:
com.google.gwt.event.shared.UmbrellaException: Exception caught: (ReferenceError) @com.amazon.ops.client.OpsMenuView::initGo()([]): go is not defined.
Can anyone please help me with this?
Try prefixing the js call with $wnd.
, eg:
var $$ = $wnd.go.GraphObject.make;
As explained here , GWT runs in a nested frame and you must use $wnd
to refer to the top level window.
Make sure that you put this statement:
<script type="text/javascript" language="javascript" src="sampleproject/go.js">
</script>
before <script src="sampleproject.nocache.js">
statement.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.