Re: JsInterop: Casting native javascript objects in gwt

2015-10-29 Thread 'Goktug Gokdogan' via GWT Users
You can only implement java contract (e.g. PayLoad class) in javascript if they are marked as isNative. See the related section in the new jsinterop doc. On Mon, Oct 26, 2015 at 5:01 AM, Brian Pedersen wrote: > Thank's for pointing that out. So i switched to the new

Re: native JsType with constants

2015-12-03 Thread 'Goktug Gokdogan' via GWT Users
Ignoring initialization is quite complicated when you put in to account generated clinit and also primitives which becomes compile-time-constants per jls and automatically inlined. Also code wise it is quite weird and potentially confusing. Workaround is quite simple, just remove the "final"

Re: native JsType with constants

2015-12-06 Thread 'Goktug Gokdogan' via GWT Users
You need to remove initialization as well because the field by Java; the point is to link to the underlying javascript. (A field that is defined by a native JsType is "native", meaning it is linked to underlying javascript and will generate code like 'canvas.nodeType == Node.ELEMENT_NODE') On

Re: native JsType with constants

2015-12-06 Thread 'Goktug Gokdogan' via GWT Users
I didn't see it was an interface, as you pointed they implicitly static and final hence requires initialization. As you suggested, you can use abstract class as well. Actually in this particular case (EventTarget,Node etc) as there are actual corresponding JavaScript types available, it is more

Re: native JsType with constants

2015-12-06 Thread 'Goktug Gokdogan' via GWT Users
On Sun, Dec 6, 2015 at 5:46 PM, Goktug Gokdogan wrote: > You need to remove initialization as well because the field by Java; the > point is to link to the underlying javascript. > > I was going to write "the field *is not owned* by Java" > (A field that is defined by a

Re: String a == String b

2016-05-26 Thread 'Goktug Gokdogan' via GWT Users
Doesn't matter in javascript; === will still return true for the same strings. On Thu, May 26, 2016 at 10:07 AM, Kirill Prazdnikov wrote: > Forgot to say: > > In Java I have > > char data1[] = new char[..]; > char data2[] = new char[..]; > > String a = new String(data1); >

Re: JsInterop receipts for simple JSNI code ?

2016-05-26 Thread 'Goktug Gokdogan' via GWT Users
JsInterop will provide some base classes for stuff that are not possible with JsInterop annotations. On Wed, May 25, 2016 at 1:30 PM, Paul Stockley wrote: > Eval is really slow. I would use JSNI. Eventually I think J2CL will have a > way to execute javascript. Just isolate

Re: JsInterop receipts for simple JSNI code ?

2016-06-25 Thread 'Goktug Gokdogan' via GWT Users
Sorry I didn't see this question earlier. It will work with both GWT and J2CL; that will be one of the main benefits. On Fri, May 27, 2016 at 6:02 AM, Paul Stockley wrote: > Will this be for J2CL only? > > On Thursday, May 26, 2016 at 6:35:36 PM UTC-4, Goktug Gokdogan

Re: JsInterop: Set length of native JavaScript array?

2016-03-19 Thread 'Goktug Gokdogan' via GWT Users
It is possible but just you cannot do it with all types (e.g. int) In that case, you are forced to declare it as Double instead. @JsMethod static void x(Double optD) { optD = optD == null ? 0 : optD; } // javascript x(); // or x(156); I need to add a more detailed section in the

Re: JsInterop: Set length of native JavaScript array?

2016-03-19 Thread 'Goktug Gokdogan' via GWT Users
For your purposes in the patch; use internal utility ArrayHelper.setLength. Normally following is just one way of doing it: interface NativeArray { @JsProperty void setLength(int length); } ((NativeArray) someArray).setLength(42); On Mon, Mar 7, 2016 at 7:53 PM, Michael Zhou

Re: Enums in Js Interop

2016-03-19 Thread 'Goktug Gokdogan' via GWT Users
You can mark it with @JsType. On Tue, Mar 15, 2016 at 6:10 AM, DavidN wrote: > I would love to know that too. > > > On Friday, March 11, 2016 at 10:10:06 AM UTC+1, suneel varma wrote: >> >> Hi All, >> >> How can I make an enum available to Javascript with Jsinterop >> >

Re: jsinterop

2016-03-20 Thread 'Goktug Gokdogan' via GWT Users
On Fri, Mar 4, 2016 at 5:18 AM, Eric Nissan wrote: > I tried that also, but > > Data[] thing = JsonUtils.safeEval(response.getText()).cast(); > > does not compile as Data[] is not a JavaScriptObject > Data[] thing = (Data[])(Object)

Happy to announce general access for J2CL!

2018-11-13 Thread 'Goktug Gokdogan' via GWT Users
Dear GWTers! We are happy to announce that we have opened up J2CL repository for general access: http://github.com/google/j2cl Please see the README for details and instructions. I also would like to use this opportunity to thank all Googlers who contributed over the years and made this happen.