Monday, December 3, 2018

Re: GWT compiler isn't allowing 'default' as a javascript object property in my JSNI block

This worked! Thank you. 

On Friday, November 30, 2018 at 8:49:34 PM UTC+5:30, David Nouls wrote:
try 'default' instead
On 30 Nov 2018, 15:17 +0100, Dylan DSouza <dyla...@gmail.com>, wrote:
I'm porting my Java LIBGDX game to Javascript. There's some JSNI code that looks something like this:

private native void hello()
/*-{
    var object1 = {default: 'foo', b: 42};
    console.log(object1.default);
}-*/
;

GWT refuses to compile this, giving me this error:

      [ERROR] Line 38: invalid property id
>       var object1 = {default: 'foo', b: 42, c: {}};
> ------------------------^
I tried the same code in native Javascript here and it works fine.

I'm guessing 'default' is some kind of keyword that GWT isn't allowing but I need to use it, because its expected by the interface I need to send the object to, specifically the Facebook Instant SDK and its LocalizableContent object.

Any help will be appreciated!

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment