cheerp 如何使用回调的回答

关于如何使用callback方法的问题很好理解,现在比较时尚的语言里都支持异步编程,事件消息或者回调。

这应该是无关优雅的, 在cheerp中你可以使用javascript一样的思维来考虑问题, 这一切编译器已经替我们处理的很好。

回调可以使用cheerp::Callback()

也可以使用getter/setter利用动态的装饰的方式来使用回调,也可以写拉姆达表达式.

pid = setTimeout(cheerp::Callback( -> void { ///hook video events install }), TICK_T);

目前好的一点是, cheerp底层已经可以满足一些重度依赖js库的程序, 实现了 js->c++->wasm 混合编程。

by 钟元 agent.zy@aliyun.com

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.

转载于:https://my.oschina.net/littlemonkeyc/blog/2999043

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值