Tencent / puerts

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.
Other
5.05k stars 704 forks source link

Top-level await支持 #1689

Open scgm0 opened 7 months ago

scgm0 commented 7 months ago

v8 9.4应该是支持Top-level await的,不过普洱不支持,是和普洱的模块加载方式有关吗?

chexiongsheng commented 7 months ago

禁用了:https://github.com/Tencent/puerts/blob/master/unity/native_src/Src/JSEngine.cpp#L99C53-L99C59

scgm0 commented 7 months ago

禁用了:https://github.com/Tencent/puerts/blob/master/unity/native_src/Src/JSEngine.cpp#L99C53-L99C59

原来如此,为什么要禁用啊?

zombieyang commented 7 months ago

executeModule一开始设计是同步的,为了兼容web也只能是同步的。且为了v8和quickjs保持一致,就把异步砍掉了。 另一方面,TLA这个特性一直以来也不觉得对js有非常大的提升,用立即执行异步函数也没太大差别。就一直没做。

chexiongsheng commented 6 months ago

这么说如果只用v8可以自行打开吧

scgm0 commented 6 months ago

这么说如果只用v8可以自行打开吧

最新的qjs也支持顶级等待了,我看大佬加了个JS_EVAL_FLAG_ASYNC宏,所以v8是不是也可以开启顶级等待了?

chexiongsheng commented 6 months ago

JS_EVAL_FLAG_ASYNC是qjs的宏。这和Top-level await没直接关系。