javascript - 新的 ECMAScript 6 导入和导出是异步的吗?

标签 javascript ecmascript-6

新的 ECMAScript 6 importexport 是异步的吗?我找到了这个: http://exploringjs.com/es6/ch_modules.html

16.2.2 ECMAScript 6 modules

The goal for ECMAScript 6 modules was to create a format that both users of CommonJS and of AMD are happy with:

  • Similarly to CommonJS, they have a compact syntax, a preference for single exports and support for cyclic dependencies.
  • Similarly to AMD, they have direct support for asynchronous loading and configurable module loading.

这是否意味着如果我有类似的东西

import * from A
import * from B

alert(1);

然后它同时下载 A 和 B,然后在两者都加载时 alert

最佳答案

不,他们不是。模块是声明性的,静态指定要导入和导出的什么

它们没有指定如何导入,那是模块加载器的工作。不同的加载器可能表现不同,有些是同步的,有些是异步的。

关于javascript - 新的 ECMAScript 6 导入和导出是异步的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41706953/

相关文章:

javascript - 如何使用 try/catch 在 Async/Await 函数中使用 Promise.all

javascript - 检查一个字符串的任何字符是否在另一个字符串javascript中的最佳方法

javascript - 使用 JavaScript 和 jQuery 获取超链接字段/列以将 SharePoint 列表中的数据显示为超链接

javascript - 我怎样才能用 cucumber 覆盖 Protractor

javascript - 如何在React Native中设置键盘上方的TextInput

javascript - 如何正确扩展 ES6 Map

javascript - 构建 Promise 对象的有效方法

windows-7 - 如何在Windows操作系统中安装Babel?

javascript - Javascript 中的类型方法

javascript - JavaScript Controller 中的 Angular JS 过滤