Closed feifeigd closed 5 years ago
Can you provide a C++ example of what you want to achieve?
You can use [[cheerp::jsexport]]
to export C++ methods to JavaScript. See also: https://github.com/leaningtech/cheerp-meta/wiki/JavaScript-interoperability
The question of how to use the callback method is well understood. Asynchronous programming, event messages or callbacks are now supported in more fashionable languages.
This should not be elegant, in cheerp you can use the same thinking as javascript, all of which compilers have handled for us very well.
Callback can use cheerp:: Callback ()
You can also use getter/setter to use callbacks using dynamic decoration, or you can write Ramda expressions.
PID = setTimeout (cheerp:: Callback ([]() - > void {
///hook video events install
}, TICK_T);
The good thing is that the bottom of cheerp can already satisfy some programs that rely heavily on JS libraries.
JS - > C + + - > WASM mixed programming is realized.
by 钟元 agent.zy@aliyun.com
sample javascript code:
method is a Function