Thursday, January 21, 2016

Re: JsInterop and indexed types

Even the old spec wasn't able to do that directly without using a helper method that maps to a one liner of JSNI code [1]. So with the current 1.0 spec you probably need to do

@JsType(isNative = true)
public class UintArray {
  public UintArray(int size) {}
  
  @JsOverlay
  public void set(int index, int value) {
     ArrayLikeJsniUtils.set(this, index, value);
  }

  @JsOverlay
  public int get(int index) {
    return ArrayLikeJsniUtils.get(this, index);
  }
}


Hope that helps. 

-- J.


[1] https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit#heading=h.ok0tzwr5fto8



--
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