JSInterop extend JavaScript object

46 views
Skip to first unread message

confile

unread,
Nov 4, 2014, 5:21:44 PM11/4/14
to google-web-tool...@googlegroups.com
Is there a way to extend a @JsType interface such that the new Java object has new properties and methods? I know that it is planned in future but is there also a posibility of doing it right now?


Here is how I do it for properties:

@JsType(prototype = "$wnd.Kinetic.Node")
public interface Node {

public static abstract class Statics {

public static native Node create() /*-{
return new $wnd.Kinetic.Node();
}-*/;
public static native void isLocked(Node node, boolean value) /*-{
node.isLocked = value;
}-*/;
public static native boolean isLocked(Node node) /*-{
return !!node.isLocked;
}-*/;

}
}


Reply all
Reply to author
Forward
0 new messages