Proposal for Object Literals and Duct-Typing in GWT

174 views
Skip to first unread message

Goktug Gokdogan

unread,
Nov 7, 2014, 8:00:53 PM11/7/14
to google-web-toolkit-contributors
Here is an early draft for adding support for JavaScript object literals in GWT JsInterop:
http://goo.gl/K2Aygn

TL;DR;
@JsType(literal=true)

class MapOptions {
  public double zoom;
  public int mapTypeId;
  public LatLon center;
}

MapOptions options = new MapOptions() {{
    zoom = 8;
    mapTypeId = ...
    center = ...
}};
will generate:
var mapOptions = {
  zoom: 8,
  mapTypeId: ...,
  center: ...,
};

And details in the document =)

Have a nice weekend!

 - Goktug

Cristian Rinaldi

unread,
Nov 12, 2014, 7:52:38 PM11/12/14
to google-web-tool...@googlegroups.com
@Goktug
some progress in this proposal?

Thanks

Goktug Gokdogan

unread,
Nov 12, 2014, 10:33:34 PM11/12/14
to google-web-tool...@googlegroups.com
We met with Ray today. We are planning to have it for GWT 3.0 but there are parts that needs to be fleshed out more before that (e.g. handling of array literals inside object literals).

--
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/e38fc867-a156-4f7b-818c-f081c97d5568%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages