alicorn-systems/v8-adapter

Adapter doesn't detect method signature with a V8Function parameter

Closed this issue · 1 comments

I'm trying to V8JavaAdapter.injectObject with an object that has this method signature:
public void alert(String title, String msg, final V8Function onOk)

and getting this error:
No signature exists for alert with parameters [title, message, function () {
console.log("pressed");
}, ].

Any idea why?

caer commented

Hey @elikonky-houzz , sorry for not seeing this issue earlier!

The V8Adapter supports Java's functional interfaces. If you replace V8Function onOk with Runnable onOk (or any other functional interface), the adapter should automatically translate the V8 method call into a Java interface.

Let me know if this works; if it doesn't, we can look into a better solution.