I have a project where i'm trying to integrate gwt 2.8 and vue.js
Originally used xsiframe linker, but ran into a race condition between vue.js doing its thing before the iframe had downloaded the code.
Which lead to trying the sso linker. A simple case that works is below. But as soon as the gwt application grows in size the call from js back into the GWT code fails (org is not defined). How do i determine that the code has loaded and it is safe to call back into the GWT generated code?
<module rename-to='start'>
<entry-point class='org.start.client.Start'/>
<source path='client'/>
<add-linker name="sso" />
</module>
package org.start.client;
import com.google.gwt.core.client.EntryPoint;
import jsinterop.annotations.JsMethod;
public class Start implements EntryPoint {
public void onModuleLoad() {
message("onModuleLoad()");
new NativeInit().init();
}
@JsMethod
public static void doSomething() {
message("doSomething()");
}
public static native void message(String msg) /*-{console.log(msg);}-*/;
}
package org.start.client;
import jsinterop.annotations.JsType;
@JsType(namespace = "initJS", isNative = true)
public class NativeInit {
public native void init() ;
}
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="Start.css">
<title>starting</title>
<script type="text/javascript" src="start/start.nocache.js"></script>
</head>
<body>
<script>
function initStart() {
console.log("in initStart");
org.start.client.Start.doSomething();
}
var initJS = {
NativeInit: function() {
this.init = initStart;
}
};
</script>
</body>
</html>
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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment