Future direction for common JS api's

241 views
Skip to first unread message

Paul Stockley

unread,
May 18, 2016, 9:25:14 AM5/18/16
to GWT Contributors
I am at the point in my GWT-React project where I need to come up with a future proof way of handling low level server communication. I was contemplating implementing the new Fetch API (with polyfills for older browsers). This would also need the promise API.

The question I have is what will the scope of elemental 2 be? Would it cover these API's? If it doesn't we should consider a standard implementation otherwise everyone will go off and implement their own versions which seems such a waste of time.

Jens

unread,
May 18, 2016, 9:50:28 AM5/18/16
to GWT Contributors
Given that Elemental 2 is developed behind closed doors, I would guess it can take TypeScript definition files and/or some IDL input to generate JS APIs for GWT / J2CL. That should cover nearly all Web APIs. IMHO TypeScript definition files would be preferred because there are tons of them on https://github.com/DefinitelyTyped/DefinitelyTyped for all kinds of JS libraries and Web APIs. It also has a definition for the Fetch API: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/whatwg-fetch 

It would be a shame if Elemental 2 would not understand them to generate APIs. These files are basically what JSweet uses to generate their Candies (http://www.jsweet.org/candies-releases/). But even if Elemental 2 only takes IDL input or html5index.org as input it should cover all standard web APIs.

-- J.

Stephen Haberman

unread,
May 18, 2016, 2:22:50 PM5/18/16
to GWT Contributors
Interesting; I had not seen JSweet before.

The javac -> TypeScript -> JS approach is surprisingly parallel (albeit with different selections) to J2CL's ecj -> closure -> JS.

- Stephen



--
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/c72a2088-bc6a-4836-9312-518ec56507cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ray Cromwell

unread,
Jun 16, 2016, 4:25:42 PM6/16/16
to GWT Contributors
Elemental2 uses typescript as it's intermediate representation, so you can do Closure Externs -> TypeScript -> JsInterop or WebIDL -> TypeScript -> JsInterop or (insert favorite syntax here) -> TypeScript -> JsInterop.

BTW, Note that JSweet really punts on most JLS semantics, so it's problematic for compiling shared or existing Java code bases.


Reply all
Reply to author
Forward
0 new messages