简体   繁体   English

Node.js上的Ecmascript 6支持

[英]Ecmascript 6 support on Node.js

I've been working with KoaJS for a while, and we can easily use the 'let' keyword and the generators when using the --harmony flag but I couldn't find how much support for does the node v0.11.x provides while using the same. 我已经和KoaJS合作了一段时间,我们可以在使用--harmony标志时轻松使用'let'关键字和生成器,但我找不到节点v0.11.x提供了多少支持同时使用相同的。

I tried using the default value argument initialization but couldn't succeed. 我尝试使用默认值参数初始化但无法成功。

Is there any source available which can list the no of features of ECS 6 supported in node v0.11.x using the harmony flag? 是否有任何可用的源可以使用和声标志列出节点v0.11.x中支持的ECS 6的功能? Or if there is any npm module available for node that might allow me to use the same? 或者,如果有任何npm模块可用于节点,可能允许我使用相同的?

Thanks in advance. 提前致谢。

With regards to your second question, yes, there is es6-module-loader . 关于你的第二个问题,是的,有es6-module-loader For a long list of transpilers, shims, and other tools for using full ES6 features now, see addyosmani's ECMAScript 6 Tools page . 有关现在使用完整ES6功能的一长串转发器,填充程序和其他工具,请参阅addyosmani的ECMAScript 6工具页面

As for native ES6 support in node.js, V8 officially implements "ECMAScript" but AFAIK the V8 project doesn't release a spec of their implementation. 至于node.js中的本机ES6支持,V8正式实现了“ECMAScript”,但AFAIK V8项目没有发布其实现规范。 However there are some sources of useful information out there. 但是,有一些有用的信息来源。 Here's a brief overview of ES6 in node.js v0.11.6 . 以下是node.js v0.11.6中ES6简要概述

You may want to determine the version of V8 that your version of node.js uses . 您可能想要确定您的node.js版本使用的V8版本 See the node.js blog for recent changelog info. 有关最近的更改日志信息,请参阅node.js博客 It can also be useful to find the version of V8 used in a given Chromium release . 找到给定Chromium版本中使用的V8版本也很有 The Chrome release notes can be found here . Chrome发行说明可在此处找到。 Keep in mind that different flags can be set for the same version of V8. 请记住,可以为相同版本的V8设置不同的标志。 Chromium and node.js both have ways to set flags in V8 related to ES6 support . Chromium和node.js都有办法在V8中设置与ES6支持相关的标志

Here are two tables that list ES(6) feature support across implementations: 以下是两个表,列出了跨实现的ES(6)功能支持:

This MDN page lists a set of reference articles for ES6 language features. 此MDN页面列出了一组ES6语言功能的参考文章。 At the bottom of each one you can see the status of Chrome support for that feature (and using V8 versions determine the support in node.js). 在每个功能的底部,您可以看到Chrome支持该功能的状态(并使用V8版本确定node.js中的支持)。

Finally, the V8 issue tracker provides a list of issues related to ES6 features, many of which have been implemented and their issues closed. 最后, V8问题跟踪器提供了与ES6功能相关的问题列表,其中许多问题已经实施并且问题已经解决。

您可以在Node.js中使用~96%的ES6功能。您可以在http://node.green/上查看对所有版本的支持。

This does not concern node 0.11, but in the current 5.8.0, you can use --harmony_default_parameter . 这与节点0.11无关,但在当前的5.8.0中,您可以使用--harmony_default_parameter

It it scheduled to be included by default in v6.0. 计划默认包含在v6.0中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM