Tuesday, September 27, 2016

JsInterop and constants


It is not clear why GWT disallow scalar and String constants in JsInterop interfaces
Previously it was

public final class MediaError extends JavaScriptObject {
public static final int MEDIA_ERR_ABORTED = 1;

Now it is impossible to declare the constant in the API declaration:

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public interface MediaError {
@JsProperty int getCode();

[ERROR] Line 11: Native JsType field 'int MediaError.MEDIA_ERR_ABORTED' cannot have initializer.

How can I add the constants ?
How can I enable scalar constants in @JsType interfaces ?


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