Eva*_*oll 7 v8 node.js ecmascript-harmony
Node v0.10.20提供了许多与和声有关的选项,
--harmony_typeof (enable harmony semantics for typeof)
--harmony_scoping (enable harmony block scoping)
--harmony_modules (enable harmony modules (implies block scoping)
--harmony_proxies (enable harmony proxies)
--harmony_collections (enable harmony collections (sets, maps, and weak maps))
--harmony (enable all harmony features (except typeof))
Run Code Online (Sandbox Code Playgroud)
我知道这些不是生产就绪的功能,而且它们正在开发中,但其中很多都足够好.
有没有办法在运行时启用它们?
"use strict";
"use harmony collections";
Run Code Online (Sandbox Code Playgroud)
像上面这样的东西.即使它不仅仅是模块级别启用这些功能,最好确保它们在模块内部启用而不是假设它们已启用.
没有办法做到这一点,解释器读取模块的内容,然后验证它们,然后评估它们。如果您将使用某些 ES6 特定语法,那么验证将失败并且代码将不会被评估。
您只能隔离 ES6 语法文件并将它们作为子进程运行(带有必要的选项),但我想这不是您想要的方式。
| 归档时间: |
|
| 查看次数: |
3692 次 |
| 最近记录: |