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 documentation for special types but I didn't have the time.
On Wed, Mar 16, 2016 at 1:47 PM, Kirill Prazdnikov <pkirill@gmail.com> wrote:
One of the problems is that it is impossible to use JsInterop for "optional values" like "x || 0"--
On Wednesday, March 16, 2016 at 9:28:20 PM UTC+3, Michael Zhou wrote:Thanks Goktug, the patch is free of JSNI methods now :)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.
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