xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

ECMAScript 2022 & Top-level await All In One

ECMAScript 2022 & Top-level await All In One

ES2022 / ES13

image

https://caniuse.com/sr_es13

Top-level await

image

https://caniuse.com/mdn-javascript_operators_await_top_level

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await

https://tc39.es/ecma262/multipage/ecmascript-language-functions-and-classes.html#sec-async-function-definitions

// fetch request
const colors = fetch("../data/colors.json").then((response) => response.json());

export default await colors;


refs

https://v8.dev/features/top-level-await

https://blog.saeloun.com/2021/11/25/ecmascript-top-level-await.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-11-27 19:07  xgqfrms  阅读(38)  评论(0编辑  收藏  举报