java - How to use GWT $entry Function in JSNI? -


the $entry function in gwt used uncaught exceptions reported javascript gwt.

what difference between following $entry calls , 1 correct one?

the following versions call instance java functions.

version 1:

public final native string test(double arg) /*-{     var instance = this;      var callexternal = $entry(function(arg) {        return instance.@com.example.myclass::javafunction(d)(arg);     });      var x = callexternal(arg); }-*/; 

version 2:

public final native string test(double arg) /*-{     var x = $entry(instance.@com.example.myclass::javafunction(d)(arg)); }-*/; 

is there different use whether use static or non static java functions?

update:

the following versions call static java functions.

version 1:

public final native string test(double arg) /*-{      var callexternal = $entry(function(arg) {        return@com.example.myclass::javafunction(d)(arg);     });      var x = callexternal(arg); }-*/; 

version 2:

public final native string test(double arg) /*-{     var x = $entry(@com.example.myclass::staticjavafunction(d)(arg)); }-*/;  

the second 1 wrong: calls method wraps result. it's useless, possibly broken.

$entry wraps function in function uses try/catch.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -