Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-22 Thread 'Ray Cromwell' via GWT Contributors
Use an annotation processor @AutoLiteral @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") class MyFoo { public int field1, field2; } @Generated(...) @JsType(IsNative = true, namespace = JsPackage.GLOBAL, name = "Object") class MyFooLiteral extends MyFoo { public

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-22 Thread Jens
> If your concert is to be able to write one-line initializers, and you are > using java8 syntax you also do something like that: > > public static T apply(T t, Consumer fn) { > fn.accept(t); > return t; > } > > @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") >

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-22 Thread Brandon Donnelson
Thanks Paul. I haven't seen use of the JsOverlay yet, that's nifty. Nice Ignacio. On Tue, Mar 22, 2016 at 6:01 AM Paul Stockley wrote: > That's a nice approach. > > > On Tuesday, March 22, 2016 at 3:25:13 AM UTC-4, Ignacio Baca Moreno-Torres > wrote: >> >> If your concert

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-22 Thread Paul Stockley
That's a nice approach. On Tuesday, March 22, 2016 at 3:25:13 AM UTC-4, Ignacio Baca Moreno-Torres wrote: > > If your concert is to be able to write one-line initializers, and you are > using java8 syntax you also do something like that: > > public static T apply(T t, Consumer fn) { >

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-22 Thread Ignacio Baca Moreno-Torres
If your concert is to be able to write one-line initializers, and you are using java8 syntax you also do something like that: public static T apply(T t, Consumer fn) { fn.accept(t); return t; } @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") class

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-21 Thread Paul Stockley
I have come up with 3 approaches to creating object literals given the current JsInterop capabilities: *1) Construct and set the fields individually* @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") class SomeObjectLiteral { int field1; String field2; }

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-21 Thread Paul Stockley
I think having a really succinct way of dealing with JS Object literals will be key to inter-op with existing java script code. Is the plan to land the enhanced support in the 2.x code base or will this be j2cl only? I really hope it will be included on 2.x In the meantime I have come up with

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-20 Thread Brandon Donnelson
Thank you! That's awesome. On Sunday, March 20, 2016 at 12:08:10 AM UTC-7, Ray Cromwell wrote: > > Right now, the best you can do is > > @JsType(isNative = true, namespace =JsPackage.GLOBAL, name = "Object") > class MyLiteral { > } > > And put js properties on the object > > > On Sat, Mar

Re: [gwt-contrib] Re: JsInterop Object Literal

2016-03-20 Thread 'Ray Cromwell' via GWT Contributors
Right now, the best you can do is @JsType(isNative = true, namespace =JsPackage.GLOBAL, name = "Object") class MyLiteral { } And put js properties on the object On Sat, Mar 19, 2016 at 11:11 PM, Brandon Donnelson wrote: > I found a doc talking about object literal

[gwt-contrib] Re: JsInterop Object Literal

2016-03-20 Thread Brandon Donnelson
I found a doc talking about object literal creation https://docs.google.com/document/d/1DFrC-GtcK7cu6DGxaWCswvb2fai9cnrWPvGcdgsKlBw/edit. -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving