Hi all,
I'm just starting with JsInterop but I can't figure out why some of the
things aren't working.
First thing first: I'm using GWT 2.7 and I've setup maven/pom
with "-XjsInteropMode" via "<jsInteropMode>JS</jsInteropMode>"
configuration:
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
[…]
<configuration>
[…]
<jsInteropMode>JS</jsInteropMode>
</configuration>
</plugin>
I tested that the flag was being correctly set by passing wrong values and
see that the compiler didn't run. I also followed
https://github.com/gwt-maven-plugin/gwt-maven-plugin/issues/89
I have the following dependencies declared in my pom:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
So my problems are the following:
*Issue #1: Can't find the JS.js method anywhere*
In the "Deep dive JS Interop" from Ray Cromwell at GWT.create 2015 (slides
<https://docs.google.com/a/byclosure.com/file/d/0ByS1wxINeBWjeGYxbkJpamxFZ28/edit>)
there are several slides that refer to a (static) "js" method. Nextgen
GWT/JS Interop (Public)
<https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#>
also
refers this method. However I can't find this method... Where is it? How
can I make my application use it?
I manage to make use of @JsType/@JsProperty via a JSNI method and an
Overlay Type, but I what I really wanted is not having to write any JSNI at
all.
@JsType
public interface UserJs {
@JsProperty String getName();
@JsProperty String getEmail();
}
public static native UserJs getUser() /*-{
return $wnd.User;
}-*/;
*Issue #2: Can't make @JsExport work*
I tried several combinations of @JsExport based on the previous slides and
Nextgen
GWT/JS Interop (Public)
<https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#>
but
couldn't manage to have any symbol exported to the global JS namespace.
E.g. I couldn't make the following example from Ray's "Deep dive JS
Interop" talk work:
@JsNamespace("mylib")
class Foo {
@JsExport
public static final int CONSTANT = 42;
}
mylib, Foo, or CONSTANT symbols aren't available in the JS runtime. What am
I doing wrong?
Thank you in advance,
Vasco
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.