Experimental release of Elemental2

3106 views
Skip to first unread message

Julien Dramaix

unread,
Jun 29, 2016, 8:23:51 PM6/29/16
to google-web-toolkit-contributors

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 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


James Horsley

unread,
Jun 30, 2016, 5:59:55 AM6/30/16
to google-web-toolkit-contributors
This is brilliant. Thanks for sharing the experimental version!!!

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CABXeq2Q%3DuH8beWj4tiG28tycASsJxK8mnxxNPZnEykUeTcMWXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Matic Petek

unread,
Jun 30, 2016, 6:15:12 AM6/30/16
to GWT Contributors
Hi,
  I would be nice If you could publish simple example how to start using it. 
Regards,
   Matic

Julien Dramaix

unread,
Jun 30, 2016, 7:16:28 AM6/30/16
to GWT Contributors
I'll try to find some time next week for uploading examples on my github account.

A simple example could be:
package elemental.sample.simple;

import static elemental2.Global.alert;
import static elemental2.Global.document;

import com.google.gwt.core.client.EntryPoint;

import elemental2.Event;
import elemental2.EventListener;
import elemental2.HTMLButtonElement;

public class SimpleApp implements EntryPoint{
public void onModuleLoad() {
final HTMLButtonElement button = (HTMLButtonElement) document.createElement("button");
button.textContent = "Click me";
button.addEventListener(
"click",
new EventListener() {
@Override
public void handleEvent(Event evt) {
button.parentNode.removeChild(button);
alert("Button has been removed.");
}
});
document.body.appendChild(button);
}
}
Elemental2.Global can be considered as the entry point of the library. It gathers all methods/fields available from the global scope (but not the window API).

--
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 google-web-toolkit-co...@googlegroups.com.

Ray Cromwell

unread,
Jun 30, 2016, 2:21:55 PM6/30/16
to google-web-toolkit-contributors
should be able to make this a little tighter:

button.addEventListener("click", (evt) -> {
button.parentNode.removeChild(button); alert("Button has been
removed."); });

:)
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/CABb_3%3D5M5DQS--awYZ1bS8nHBu9po8Ne8JPY_ianrUjNZrSqyg%40mail.gmail.com.

Ignacio Baca Moreno-Torres

unread,
Jun 30, 2016, 6:03:06 PM6/30/16
to GWT Contributors
I just applied elemental2 to this simple drang&drop and FileReader showcase (https://github.com/ibaca/dndfiles-gwt/blob/master/src/main/java/dndfiles/client/DndFiles.java). Elemental2 looks good, but I think that JsInterop still a bit... unpredictable. The project compiles correctly, but the codeserver fails, pruning/ignoring some methods. Or maybe I do not set the generateJsInteropExports correctly... not sure, but even if this is the problem, I'm still confusing why I need this flag if I'm not exporting anything. If I do not set this flag, the project do not work (some lambdas are pruned).
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/01963a7c-7972-4fd9-88ef-629d0a7bcbac%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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

Goktug Gokdogan

unread,
Jun 30, 2016, 6:16:34 PM6/30/16
to google-web-toolkit-contributors
You are probably missing the flag.
In this particular situation you are implementing a native JsType and that is considered a form exporting in current compiler and hence affected by the flag. I know that is surprising and it will be fixed in https://gwt-review.googlesource.com/#/c/15193/ (which will be submitted before the final release).

>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/01963a7c-7972-4fd9-88ef-629d0a7bcbac%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/08b1f7b2-3682-4c83-977d-79c729cc2796%40googlegroups.com.

Ignacio Baca Moreno-Torres

unread,
Jul 1, 2016, 2:42:35 AM7/1/16
to GWT Contributors
Yep, not sure why... but I just try again and the parameter is used correctly by the codeserver, so it works as you said. When you said 'you are implementing a native JsType' you are talking about the JsFunction callbacks, isn't it? The issue said 'do not honor' so looks like the opposite direction (I mean, 'do not honor' is what is happening before issue is fixed or what should happen after the issue is fixed). To confirm, will this issue make this native JsFunction callbacks works without the export flag?
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/01963a7c-7972-4fd9-88ef-629d0a7bcbac%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Goktug Gokdogan

unread,
Jul 1, 2016, 4:33:22 AM7/1/16
to google-web-toolkit-contributors
On Thu, Jun 30, 2016 at 11:42 PM, Ignacio Baca Moreno-Torres <ign...@bacamt.com> wrote:
Yep, not sure why... but I just try again and the parameter is used correctly by the codeserver, so it works as you said. When you said 'you are implementing a native JsType' you are talking about the JsFunction callbacks, isn't it?

No, I'm talking about JsType(isNative=true). The lambda in your code implements EventListener which is a native JsType interface; not a JsFunction.

 
The issue said 'do not honor' so looks like the opposite direction (I mean, 'do not honor' is what is happening before issue is fixed or what should happen after the issue is fixed).

Yes, the patch description is not accurate. It stops honoring non-native JsType names in SDM to detect missing flag early on. In addition to that, it also makes sure that if you are implementing  a native JsType, it works with or without the flag. The description doesn't capture this part.
 
To confirm, will this issue make this native JsFunction callbacks works without the export flag?


JsFunction implementations already work with or without the flag. The patch will also make sure native JsType implementations to work with or without the flag.
So if you are using elemental, you won't need the flag (more common).
If you are exporting a Java API to be used by some JavaScript, you will need the flag (less common).

 
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/01963a7c-7972-4fd9-88ef-629d0a7bcbac%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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

--
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 google-web-toolkit-co...@googlegroups.com.

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/e885d86d-cb93-4f4e-a086-f0e2ea803d27%40googlegroups.com.

Ignacio Baca Moreno-Torres

unread,
Jul 1, 2016, 6:10:04 AM7/1/16
to GWT Contributors
Thanks, now makes sense. I get confused with the JsFunction JsType(native) because elemental2 has some callbacks as JsFunction and others as JsType(native), now an actual elemental2 question; what criteria is used to apply JsFunction (ex. elemental2.Node.AddEventListenerCallback) instead of JsType (ex. elemental2.JsType)?
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/01963a7c-7972-4fd9-88ef-629d0a7bcbac%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Ignacio Baca Moreno-Torres

unread,
Jul 1, 2016, 6:12:01 AM7/1/16
to GWT Contributors
JsType example is: elemental2.EventListener.

Jens

unread,
Jul 1, 2016, 6:39:26 AM7/1/16
to GWT Contributors

Thanks, now makes sense. I get confused with the JsFunction JsType(native) because elemental2 has some callbacks as JsFunction and others as JsType(native), now an actual elemental2 question; what criteria is used to apply JsFunction (ex. elemental2.Node.AddEventListenerCallback) instead of JsType (ex. elemental2.JsType)?

I think its the result of definition of EventTarget.addEventListener():

listener - The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.

The EventListener interface is a defined API and thus a @JsType(isNative = true) interface has been generated. But to conform to "or simply a JavaScript function" there is also an AddEventListenerCallback that is a @JsFunction. Not sure if this distinction has any real value, in a hand coded elemental2 I would have only created a @JsFunction interface EventListener

-- J.

Goktug Gokdogan

unread,
Jul 1, 2016, 10:38:00 PM7/1/16
to google-web-toolkit-contributors
Closure extern definition uses a union type here:

So it accepts either EventListener interface or a function.

When we see a union type, we generate overloads for each type so Elemental should provide overloads that includes both. And it seems like it does. If not please let us know.

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/73b36bdb-c496-4768-a221-21fe8b5a437c%40googlegroups.com.

Manuel Carrasco Moñino

unread,
Jul 2, 2016, 5:07:16 PM7/2/16
to google-web-toolkit-contributors
I'm wondering if it would be possible to have type-safe convenience methods for creating elements, so as the user does not have to provide the string tag name, nor cast the object, maybe something like :

HTMLButtonElement button = HTMLButtonElement.createElement();

instead of

HTMLButtonElement button = (HTMLButtonElement) document.createElement("button");


Ignacio Baca Moreno-Torres

unread,
Jul 2, 2016, 5:50:15 PM7/2/16
to google-web-toolkit-contributors
+1 to add some type-safe, in my current mini-project (almost 50 lines of code) there are 5 cast! 2 elements, 2 events and 1 event target... the event target is mandatory, but the events and elements will be nice to be type-safe.

Paul Stockley

unread,
Jul 2, 2016, 9:13:17 PM7/2/16
to GWT Contributors
Would it be possible to break the project into a few packages? It would make it easier to find things.

Jakob Jarosch

unread,
Jul 3, 2016, 7:18:28 AM7/3/16
to GWT Contributors
It seems that the deployed dependency is inconsistent.
The pom.xml says "elemental-experimental" with version "2016-06-30".
But the dependency is available as "elemental2-experimental" with version "16-06-30".
So gradle is not able to resolve the dependency.

Warning:project ':frontend': Web Facets/Artifacts will not be configured properly
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':frontend:runtime'.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.google.gwt:elemental2-experimental:16-06-30.
Required by:
    itdidea:frontend:unspecified
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.google.gwt:elemental2-experimental:16-06-30.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: inconsistent module metadata found. Descriptor: com.google.gwt:elemental-experimental:2016-06-29 Errors: bad module name: expected='elemental2-experimental' found='elemental-experimental'
bad version: expected='16-06-30' found='2016-06-29'

- Jakob


On Thursday, June 30, 2016 at 2:23:51 AM UTC+2, Julien Dramaix wrote:

Thomas Broyer

unread,
Jul 3, 2016, 7:52:54 AM7/3/16
to GWT Contributors


On Sunday, July 3, 2016 at 1:18:28 PM UTC+2, Jakob Jarosch wrote:
It seems that the deployed dependency is inconsistent.
The pom.xml says "elemental-experimental" with version "2016-06-30".
But the dependency is available as "elemental2-experimental" with version "16-06-30".

Wow, and Sonatype let it go in?! Looks like they need better checks.
 
So gradle is not able to resolve the dependency.

Warning:project ':frontend': Web Facets/Artifacts will not be configured properly
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':frontend:runtime'.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.google.gwt:elemental2-experimental:16-06-30.
Required by:
    itdidea:frontend:unspecified
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.google.gwt:elemental2-experimental:16-06-30.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: inconsistent module metadata found. Descriptor: com.google.gwt:elemental-experimental:2016-06-29 Errors: bad module name: expected='elemental2-experimental' found='elemental-experimental'
bad version: expected='16-06-30' found='2016-06-29'

Fortunately, Gradle is flexible enough.
Because elemental2-experimental has no dependency, I think you can use 'com.google.gwt:elemental2-experimental:16-06-30@jar', or alternatively use a "client module" with the module('com.google.gwt:elemental2-experimental:16-06-30') notation (difference with the "@jar" is that you can declare dependencies of the module, thereby replacing the bad POM with your own module definition). 

Goktug Gokdogan

unread,
Jul 4, 2016, 3:46:44 AM7/4/16
to google-web-toolkit-contributors
Elemental2 currently purely driven by the JavaScript extern files. So it is not trivial. Maybe a later version could include some kind of type extension.
For now perhaps we can improve the generated code to use generics so you don't need to cast but we cannot modify the API.

Goktug Gokdogan

unread,
Jul 4, 2016, 3:46:59 AM7/4/16
to google-web-toolkit-contributors
We will look into that.

On Sat, Jul 2, 2016 at 6:13 PM, Paul Stockley <pstoc...@gmail.com> wrote:
Would it be possible to break the project into a few packages? It would make it easier to find things.
--
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 google-web-toolkit-co...@googlegroups.com.

Julien Dramaix

unread,
Jul 4, 2016, 8:32:16 AM7/4/16
to GWT Contributors
yes, we are thinking about that. We would like also to add a feature checking system.
 AFAIC, I think this kind of wrapper code should be part of a separate library using elemental. I would like that elemental stays "close to the metal".
But we don't have decided anything yet now.


On Saturday, July 2, 2016 at 11:07:16 PM UTC+2, Manuel Carrasco Moñino wrote:
I'm wondering if it would be possible to have type-safe convenience methods for creating elements, so as the user does not have to provide the string tag name, nor cast the object, maybe something like :

HTMLButtonElement button = HTMLButtonElement.createElement();

instead of

HTMLButtonElement button = (HTMLButtonElement) document.createElement("button");



El sáb., 2 jul. 2016 a las 4:38, 'Goktug Gokdogan' via GWT Contributors (<google-web-toolkit-contri...@googlegroups.com>) escribió:
Closure extern definition uses a union type here:

So it accepts either EventListener interface or a function.

When we see a union type, we generate overloads for each type so Elemental should provide overloads that includes both. And it seems like it does. If not please let us know.
On Fri, Jul 1, 2016 at 3:39 AM, Jens <jens.ne...@gmail.com> wrote:

Thanks, now makes sense. I get confused with the JsFunction JsType(native) because elemental2 has some callbacks as JsFunction and others as JsType(native), now an actual elemental2 question; what criteria is used to apply JsFunction (ex. elemental2.Node.AddEventListenerCallback) instead of JsType (ex. elemental2.JsType)?

I think its the result of definition of EventTarget.addEventListener():

listener - The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.

The EventListener interface is a defined API and thus a @JsType(isNative = true) interface has been generated. But to conform to "or simply a JavaScript function" there is also an AddEventListenerCallback that is a @JsFunction. Not sure if this distinction has any real value, in a hand coded elemental2 I would have only created a @JsFunction interface EventListener

-- J.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Julien Dramaix

unread,
Jul 4, 2016, 8:33:23 AM7/4/16
to GWT Contributors
yep it's planned

Julien Dramaix

unread,
Jul 4, 2016, 8:35:22 AM7/4/16
to GWT Contributors
I'm fixing my script in order to avoid that for the next release.

Thanks for the bug reporting!


On Sunday, July 3, 2016 at 1:18:28 PM UTC+2, Jakob Jarosch wrote:

Kalle Persson

unread,
Jul 4, 2016, 9:24:20 AM7/4/16
to GWT Contributors
So I guess this is also the reason for why e.g. Int32Array returns double instead of int?

Also, would it be possible / make sense to make CanvasRenderingContext2D and WebGLRenderingContext extend NativeObject?
Right now, as HTMLCanvasElement.getContext(String contextId) returns a NativeObject I have to do things like this when getting the context:

context_ = (CanvasRenderingContext2D) (Object) canvas.getContext("2d")

It works but it feels wrong. Or am I just missing something obvious?

On Monday, July 4, 2016 at 9:46:44 AM UTC+2, Goktug Gokdogan wrote:
Elemental2 currently purely driven by the JavaScript extern files. So it is not trivial. Maybe a later version could include some kind of type extension.
For now perhaps we can improve the generated code to use generics so you don't need to cast but we cannot modify the API.
On Sat, Jul 2, 2016 at 2:07 PM, Manuel Carrasco Moñino <man...@apache.org> wrote:
I'm wondering if it would be possible to have type-safe convenience methods for creating elements, so as the user does not have to provide the string tag name, nor cast the object, maybe something like :

HTMLButtonElement button = HTMLButtonElement.createElement();

instead of

HTMLButtonElement button = (HTMLButtonElement) document.createElement("button");



El sáb., 2 jul. 2016 a las 4:38, 'Goktug Gokdogan' via GWT Contributors (<google-web-toolkit-contri...@googlegroups.com>) escribió:
Closure extern definition uses a union type here:

So it accepts either EventListener interface or a function.

When we see a union type, we generate overloads for each type so Elemental should provide overloads that includes both. And it seems like it does. If not please let us know.
On Fri, Jul 1, 2016 at 3:39 AM, Jens <jens.ne...@gmail.com> wrote:

Thanks, now makes sense. I get confused with the JsFunction JsType(native) because elemental2 has some callbacks as JsFunction and others as JsType(native), now an actual elemental2 question; what criteria is used to apply JsFunction (ex. elemental2.Node.AddEventListenerCallback) instead of JsType (ex. elemental2.JsType)?

I think its the result of definition of EventTarget.addEventListener():

listener - The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs. This must be an object implementing the EventListener interface, or simply a JavaScript function.

The EventListener interface is a defined API and thus a @JsType(isNative = true) interface has been generated. But to conform to "or simply a JavaScript function" there is also an AddEventListenerCallback that is a @JsFunction. Not sure if this distinction has any real value, in a hand coded elemental2 I would have only created a @JsFunction interface EventListener

-- J.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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 google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Julien Dramaix

unread,
Jul 4, 2016, 10:15:22 AM7/4/16
to GWT Contributors
So I guess this is also the reason for why e.g. Int32Array returns double instead of int?
yes we just have the information that it's a number, so we convert that to double. We should be able to improve the number conversion before the final release.

Right now, as HTMLCanvasElement.getContext(String contextId) returns a NativeObject I have to do things like this when getting the context:

This is an isue we are aware of. In the next release, Object will be used instead of NativeObject.



To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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 google-web-toolkit-co...@googlegroups.com.

--
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 google-web-toolkit-co...@googlegroups.com.

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/023e92c6-8f9f-41b4-8203-369b82499d7f%40googlegroups.com.

Paul Stockley

unread,
Jul 4, 2016, 11:10:32 AM7/4/16
to GWT Contributors
I do think we should have another library that builds on Elemental2. While browser compatibility is a lot better, it still isn't perfect and we need  somewhere to collect workarounds for specific issues and add helper functions to make working with the library easier.

Jens

unread,
Jul 4, 2016, 12:32:23 PM7/4/16
to GWT Contributors

I do think we should have another library that builds on Elemental2. While browser compatibility is a lot better, it still isn't perfect and we need  somewhere to collect workarounds for specific issues and add helper functions to make working with the library easier.

But then you have the GWT overhead on top of it again. But I tend to agree that a purely generated API can never be that nice to use as a hand crafted one. I have only taken a very brief look at the generated code of the elemental2 snapshot build but I think my major points are:

- vendor prefixes. Sticking to standard API and asking devs to polyfill them if needed sounds better to me. Avoids potential API duplication.
- only doubles while int would make sense here and there
- no use of generics and enums
- no packages. Would be nice to have things like dom, crypto, promise, audio, webgl, etc.
- often method signature defines Object as return type while I am pretty sure something more concrete would be more appropriate.
- obviously no JavaDoc, but it would be nice to have. Especially for people working in a no-internet environment.
- edge cases like EventTarget.addEventListener(EventListener) and EventTarget.addEventListener(AddEventListenerListenerCallback) that should be cleaned up

Maybe it is worth thinking about providing some patch files in addition to the generator to fix some stuff that are hard to fix inside the elemental2 generator. Given that existing non-prefixed API does not change these patch files should be pretty stable and always applicable.

-- J.

Julien Dramaix

unread,
Jul 4, 2016, 1:55:39 PM7/4/16
to GWT Contributors
> - only doubles while int would make sense here and there
we are aware of that. That should be solved before the first release

> - no use of generics and enums
generics are used (look at NativeArray ot HtmlCollection). Enums not yet

> - no packages. Would be nice to have things like dom, crypto, promise, audio, webgl, etc.
it's planned

> - often method signature defines Object as return type while I am pretty sure something more concrete would be more appropriate.

if a method "getFoo" can return different types "string or Foo", we create different methods :
public Object getFoo();
public String getFooAsString();
public Foo getFooAsFoo();

In the future there will be javadoc above the methods mentioning these links between a set of methods.

> - obviously no JavaDoc, but it would be nice to have. Especially for people working in a no-internet environment.
As mentioned above, it's planned

> - edge cases like EventTarget.addEventListener(EventListener) and EventTarget.addEventListener(AddEventListenerListenerCallback) that should be cleaned up
I don't think we will clean that up. At least it's not planned.

--
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 google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/71f5352a-41dc-4f91-a22b-9a9bb21b8bbb%40googlegroups.com.

Jens

unread,
Jul 4, 2016, 3:05:04 PM7/4/16
to GWT Contributors

> - often method signature defines Object as return type while I am pretty sure something more concrete would be more appropriate.

if a method "getFoo" can return different types "string or Foo", we create different methods :
public Object getFoo();
public String getFooAsString();
public Foo getFooAsFoo();

In the future there will be javadoc above the methods mentioning these links between a set of methods.

What about methods that do not return different types and sometimes even should return void? For example 

void Window.alert(String)
void Window.focus()
long Date.setDate(int)

They all return Object currently.

-- J.

Julien Dramaix

unread,
Jul 4, 2016, 3:26:02 PM7/4/16
to GWT Contributors
This is a bug :)
That should be void and not object.

--
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 google-web-toolkit-co...@googlegroups.com.

Steve Andrews

unread,
Jul 21, 2016, 10:34:19 AM7/21/16
to GWT Contributors
I've been trying out the new Elemental and have been having trouble with EventListener. I'm on the latest GWT Snapshot (2.8.0-20160721.060317-297). It seems that the EventListener gets compiled out unless I use the Node.AddEventListenerListenerCallback function. Example:

searchButton.addEventListener("click",e -> doSearch());

This gets compiled out and never gets called.

searchButton.addEventListener("click", e-> {doSearch();return true;});

This works using the AddEventListenerListenerCallback function.

I've tried compiling with and without the -generateJsInteropExports flag and get the same result. I was using an earlier GWT snapshot version (end of June) until a few days ago and didn't get the problem with that version.

Any ideas or is this a bug?
Thanks
Steve

Steve Andrews

unread,
Jul 22, 2016, 3:08:57 AM7/22/16
to GWT Contributors
I've now got this to work. I cleaned my SDM cache :-) 

It only works with the generateJsInteropExports flag set though.

Jakob Jarosch

unread,
Jul 22, 2016, 5:50:22 AM7/22/16
to GWT Contributors
I made similar experiences, in GWT 2.8 the SDM cache is sometimes corrupt and even a restart of SDM won't bring it back alive. Only solution I found was cleaning temporary files.
In GWT 2.7 there was sometimes the need to restart SDM, but never the need to clean the temporary files.

Jens

unread,
Jul 22, 2016, 6:31:24 AM7/22/16
to GWT Contributors

It only works with the generateJsInteropExports flag set though.

Sounds like a bug to me.

-- J.

Steve Andrews

unread,
Jul 28, 2016, 3:27:35 AM7/28/16