We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好, 非常感谢作者提供的这个仓库...
我测试代码如下 , 也可以尝试我创建的测试例子 https://github.com/jiajiawei/test_flutter_qjs
var a = 1; final engine = FlutterQjs()..dispatch(); try { JSInvokable setToObject = engine.evaluate('(key, value) => this[key] = value;'); setToObject.invoke(['a', IsolateFunction(() => a)]); print(engine.evaluate('a()')); // Instance of 'Future<dynamic>' } catch (e) { print('[JsEngine] Fail to eval script. \n$e'); } finally { engine.port.close(); }
我想得到1,但是结果是Instance of 'Future'
我改了object.dart三处代码, 把Future 和 aysnc都去掉临时解决了. 但是我觉得这不是正常方案. 希望作者有空解决下. 感激不尽
(还有272行的invoke方法没截上)
The text was updated successfully, but these errors were encountered:
直接传function
var a = 1; final engine = FlutterQjs()..dispatch(); try { JSInvokable setToObject = engine.evaluate('(key, value) => this[key] = value;'); setToObject.invoke(['a', () => a]); print(engine.evaluate('a()')); } catch (e) { print('[JsEngine] Fail to eval script. \n$e'); } finally { engine.port.close(); }
IsolateFunction 是为了多线程(isolate)模式能异步调用做的wrapper
IsolateFunction
Sorry, something went wrong.
谢谢 👍
No branches or pull requests
您好, 非常感谢作者提供的这个仓库...
我测试代码如下 , 也可以尝试我创建的测试例子 https://github.com/jiajiawei/test_flutter_qjs
我想得到1,但是结果是Instance of 'Future'
我改了object.dart三处代码, 把Future 和 aysnc都去掉临时解决了. 但是我觉得这不是正常方案. 希望作者有空解决下. 感激不尽
(还有272行的invoke方法没截上)
The text was updated successfully, but these errors were encountered: