Hi Brian,
I had problems similar to you when studying JsInterop, so I've tried your
code.
I've forked your repo (see https://github.com/cristcost/jspoc) and I have
made it work but with some considerations to take into account.
Other than the problems on using JsInterop annotations as reported
Update:
with the sso linker the project responds as expected: the GWT code is
available as soon as page has loaded
You could check it out on this branch:
https://github.com/cristcost/jspoc/tree/test_with_sso
note that:
- with sso linker super dev mode don't work (I've worked manually
It all makes perfectly sense now, thank's a lot for taking your time to
clarify your findings.
I like the concept of the sso linker, a pity it doesn't work with super dev
mode yet.
Using JsInterop with the xsiframe linker in super dev mode works equally
bad for me, but maybe that's just me
I use gwt-maven-plugin 2.8.0-SNAPSHOT for no reason in particular,
but if you use 2.7.0 and you want to compile correctly with version 2.8.0
of GWT, remember to override the plugin configuration like explained in
this
page
Thank's Jens, your help is much appreciated. For now I will definitely go
for a no-renaming approach.
It must be something with the way I run my code server.
I still get the same error, and when I inspect the generated javascript in
my browser, it still has the obfuscated format.
The
That didn't seem to make much of a difference, the generated javascript
still have the wrong identifiers, and the error message is the same :(
I wonder if there is something wrong with my build, it looks to me as if
the annotations are ignored.
I know that I run gwt 2.8, as I did a lambda to
@JsNamespace("$wnd.poc")
@JsExport("Hello")
@JsType
public class JsHello {
public String sayHello(String name) {
return "Hello " + name;
}
}
I think the above should work. But there is already a commit pending which
introduces new annotations for JsInterop which should make things a bit
Ok just played a bit and its like the following:
@JsExport // value attribute is ignored here, probably because it acts as a
shortcut to apply @JsExport to any static member
@JsType // required so you also have exported instance members (your
sayHello method) and not just static members
So I am doing my first baby-steps in JsInterop, exposing a Java class to
javascript, and I can't seem to figure out what I am doing wrong.
*My java class looks like this:*
@JsExport("poc.Hello")
public class JsHello {
public String sayHello(String name) {
return "Hello " + name;
}
}