Skip to content

Instantly share code, notes, and snippets.

@kirillp
Last active December 12, 2016 15:49
Show Gist options
  • Save kirillp/c443966b28ca68cd21e51ff802fde97d to your computer and use it in GitHub Desktop.
Save kirillp/c443966b28ca68cd21e51ff802fde97d to your computer and use it in GitHub Desktop.
@JsFunction
interface Interface {
Interface invoke(String arg);
}
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
class Exports {
@JsProperty(namespace = JsPackage.GLOBAL)
public static native void setInterface(Interface value);
}
@SuppressWarnings("Duplicates")
public class ExportInterface implements EntryPoint {
@Override
public void onModuleLoad() {
JsGlobals.getWindow().getConsole().log("setting Interface");
Interface value = new Interface() {
@Override
public Interface invoke(String arg) {
JsGlobals.getWindow().getConsole().log(arg);
return this;
}
};
Exports.setInterface(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment