Tuesday, July 22, 2014

Re: Trying to get an object with a number array out of a js script



On Tuesday, July 22, 2014 11:15:18 AM UTC+2, Jens wrote:
No: TestObj.member1 is evaluated to a function and then called as a constructor with the arguments: http://www.ecma-international.org/ecma-262/5.1/#sec-11.2.2

I definitely have to read more about JS. Thanks for correcting.

Just noticed "this.x" in the JSNI method getAsJsObj(). Shouldn't that be "this.@my.package.to.TestObjJava::x" ?

Ha, that's it!

I'd rather extract a static method taking the values as parameters to avoid the JSNI syntax though:

public TestObjJS getAsJSObj() {
  return getMem1(this.x, this.y);
}

private static native TestObjJS getMem1(double x, double y) /*-{
  return $wnd.getMem1(x, y);
}-*/;

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

No comments:

Post a Comment