Hi, 
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:

@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;
  }
}






This TextInsertedEvent class is not allowed to be instantiated directly in 
javascript, so do not need to export its constructor.

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 "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/51243cc7-d7f0-4f4a-a501-77dafe52b7c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to