Skip to content

Instantly share code, notes, and snippets.

@imjasonh
Created March 11, 2012 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imjasonh/2018382 to your computer and use it in GitHub Desktop.
Save imjasonh/2018382 to your computer and use it in GitHub Desktop.
public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
doJsni();
}
private static void staticMethod(int num) {
Window.alert("Static method called " + num);
}
private void instanceMethod(String str) {
Window.alert("Instance method called " + str);
}
private native final void doJsni() /*-{
var btn = document.createElement('button');
btn.onClick = $entry(function() {
// To call a static method...
@com.this.package.client.MyEntryPoint::staticMethod(int)(3);
// To call an instance method on this instance of MyEntryPoint...
this.@com.this.package.client.MyEntryPoint::instanceMethod(Ljava/lang/String;)("string");
});
}-*/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment