Hi,
When i translate a pure java library to a javascript library using JsInterop, i get confused about @JsProperty and JsType.prototype().
When someone using the translated js library in a pure javascript web application:
1. How to prevent the prototype name from obfuscated?
e.g. realtime.store.TextInsertedEvent.isPrototypeOf(evt) should returns true
evt is a TextInsertEvent instance created from the translated library
2. How to translate to dotted property accessor instead of method calls?
e.g. enable users to call evt.text to get the actual string value, not evt.text()
When i translate a pure java library to a javascript library using JsInterop, i get confused about @JsProperty and JsType.prototype().
The java code looks like this:
This TextInsertedEvent class is not allowed to be instantiated directly in javascript, so do not need to export its constructor.
@JsType
@JsNamespace("$wnd.realtime.store")
public class TextInsertedEvent {
/**
* The index of the change.
*/
public final int index;
/**
* The inserted text
*/
public final String text;
/**
* @param serialized The serialized event object.
*/
TextInsertedEvent(JsonObject serialized) {
this.index = (int) serialized.getNumber("index");
this.text = serialized.getString("text");
}
public int index() {
return index;
}
public String text() {
return text;
}
}
When someone using the translated js library in a pure javascript web application:
1. How to prevent the prototype name from obfuscated?
e.g. realtime.store.TextInsertedEvent.isPrototypeOf(evt) should returns true
evt is a TextInsertEvent instance created from the translated library
2. How to translate to dotted property accessor instead of method calls?
e.g. enable users to call evt.text to get the actual string value, not evt.text()
Thanks for help :)
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.