Skip to content
New issue

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

Top-level await支持 #1689

Open
scgm0 opened this issue Mar 28, 2024 · 6 comments
Open

Top-level await支持 #1689

scgm0 opened this issue Mar 28, 2024 · 6 comments

Comments

@scgm0
Copy link
Contributor

scgm0 commented Mar 28, 2024

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

@chexiongsheng
Copy link
Collaborator

@scgm0
Copy link
Contributor Author

scgm0 commented Apr 1, 2024

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

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

@zombieyang
Copy link
Contributor

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

@chexiongsheng
Copy link
Collaborator

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

@scgm0
Copy link
Contributor Author

scgm0 commented Apr 22, 2024

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

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

@chexiongsheng
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants