I tried this out by converting a small project that was using elemental 1
to elemental 2. I was able to get it to compile both in dev mode and in a
production compile. But my event listeners weren't firing at all when I
ran it.
Some feedback:
1) Lambda event listeners have to be cast into order to avoid an error from
"javac":
[javac] /Users/john/.../src/com/App.java:208: error: reference to
addEventListener is ambiguous
[javac] doc.getElementById("list").addEventListener("click", event ->
listPressed(event));
[javac] ^
[javac] both method
addEventListener(String,AddEventListenerListenerCallback) in Node and
method addEventListener(String,EventListener) in Node match
You can avoid this error with an explicit cast to EventListener (or
AddEventListenerListenerCallback), but that isn't ideal:
.addEventListener("click", (EventListener)event -> listPressed(event));
2) Some things weren't defined on HTMLElement that I needed, namely:
"outerHTML" and "children". These were available in elemental 1. They can
be added by extending the class like so and casting to it:
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class HTMLElementEx extends HTMLElement {
public String outerHTML;
public HTMLCollection<HTMLElement> children;
}
On Wednesday, June 29, 2016 at 7:23:51 PM UTC-5, Julien Dramaix wrote:
>
> A new experimental version of Elemental2 using the new JsInterop
> specification has been pushed on Sonatype today.
>
> You can try it by downloading the jar file
> <https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/gwt/elemental2-experimental/16-06-30/elemental2-experimental-16-06-30.jar>
>
> or adding this following maven dependency:
>
> <dependency>
>
> <groupId>com.google.gwt</groupId>
>
> <artifactId>elemental2-experimental</artifactId>
>
> <version>16-06-30</version>
>
> </dependency>
>
> Then, inherits the elemental2 module:
>
> <inherits name="elemental2" />
>
> This experimental version works only with the last 2.8-snapshot release of
> GWT.
>
> The goal of this release is to get feedback so don’t hesitate to report
> any bugs, issues, concerns you have on this mailing list.
>
>
> Important note: This is an experimental release and without doubt the
> future updates until the final release are going to break code!
>
> - Julien
>
>
--
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit-contributors/d4cb6c43-cd40-494d-88eb-2aa786a18b6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.