ekibun/flutter_qjs

support call function name

guzishiwo opened this issue · 1 comments

Can support loading js with multiple functions and then calling the specified function name?

final js = """
function a() {}

function b() {}

function c() {}
""";

final jsInvokable = engine.evaluate(js);
jsInvokable.invoke("a", [])

You can return an object that contains the functions and get from map

final js = """
({
   a: function () {},
   b: function () {},
   c: function () {},
})
""";
final ret = engine.evaluate(js);
ret["a"].invoke([])