My GWT app is designed to have an iframe with another web app (not GWT this time) embedded in it. This embedded app expects to be able to call some APIs in my parent app like so:
window.parent.f(function(result) { console.log("Result == " + result); });
How do I declare a JSNI function that can take that function as a parameter?
private static final void f(Consumer<String> onsuccess) {
onsuccess.accept("abcd");
}
public static native void installApi() /*-{
$wnd.f = function(onsuccess) {
@my.package.client.Example::f(...); // What goes in here?
}
}-*/;