How to expose class functionality in GWT

后端 未结 2 567
無奈伤痛
無奈伤痛 2021-01-14 04:49

I have a class library written in Java and want to convert it to Javascript. All methods are pretty simple and mostly have to do with manipulating collections. I have this o

相关标签:
2条回答
  • 2021-01-14 05:30

    This may help.

    http://code.google.com/p/gwtchismes/wiki/Tutorial_ExportingGwtLibrariesToJavascript_en

    0 讨论(0)
  • 2021-01-14 05:43

    You have exposed only instance of the GameControl. If you want to expose other methods, you'll have to expose them as well. For example:

     public native void expose()/*-{
            var control = this.@game.client.GameEntryPoint::_gameControl;   
            var gameInstance = {
                gameControl: control,
                isEmpty:function(param){
                  control.@game.client.GameEntryPoint::isEmpty(*)(param);   
                }  
    
            }
    
    
            $wnd.game = gameInstance;
        }-*/;
    

    Also there is a framework called gwt-exporter, it might make things easier for you

    0 讨论(0)
提交回复
热议问题