Thursday, August 20, 2015

Re: Polymer Integration in the next GWT versions?

Hi Jens

thank you for your answers they clear a lot of my questions.

In the meantime I also saw GWT.create 2015 - Deep dive in JS Interop (Ray Cromwell) https://www.youtube.com/watch?v=-s4Wfnojh1Q which I had scheduled and then forgot and then found again after I posted the questions above. It is 45min long but it gives a lot of examples of how things will look like and it also helped me a lot to clear things out.

The snippet near the end that Ray parses and automatically generates JSInterop bindings from w3 specs was pretty impressive.

Thanks also for the JsDoc mention. I didn't know that a such a thing exists https://github.com/vaadin/gwt-api-generator

    Vassilis

On Thu, Aug 20, 2015 at 1:19 PM, Jens <jens.nehlmeier@gmail.com> wrote:

1) Can you give a concrete example on how much that cost will lower in comparison with JSNI?

It won't lower. You still have to keep things in sync. If the library in question uses something like JsDoc you can code a generator to produce the Java API.
 

2) Right now I am using JSNI to fill even GWT unimplemented functionality - for example querySelectorAll(). Will that would be possible with JsInterop? or this is an Elemental thingy?

Sure, JsInterop and JSNI are not very different. Instead of implementing JSNI one-liner methods you only define an interface and put an annotation on it. With Java8 there is even the idea that you can put a default method in your Jsinterop interface which contains a polyfill implementation. GWT will then transparently check if that method natively exists and if not call the polyfill code. But I don't know if that is still planned or if they expect you to install the polyfill manually.

Elemental 2.0 will be generated against html5index.org (which in turn is generated from all kinds of IDLs and spec pages) and thus will allow you to access all browser APIs. 


3) If it's an elemental thingy (creating java binidings from IDL) - wouldn't that approach be usable also for other 3rd party js libraries (write an IDL file for each one of them)?

Sure. You just need some extra metadata so you know the types returned and consumed by JS methods. This can be done through IDL or things like JsDoc. For example Vaadin has a JsDoc based generator they have used to generate the Polymer integration: https://github.com/vaadin/gwt-api-generator


-- J.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment