博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[ES6] 01. Intro to ES6 and traceur compiler
阅读量:7239 次
发布时间:2019-06-29

本文共 2410 字,大约阅读时间需要 8 分钟。

---恢复内容开始---

ES6 is ECMAScript version 6, which JavaScript is based on. The next version of JavaScript is going to be based on version 6 of ECMAScript.

Tracer is a way to compile that next version of JavaScript back into JavaScript of today, meaning that you can write the next version of JavaScript and have it compiled down to JavaScript you can use today, because ES6 isn't supported completely and not standardized completely across all the browsers, in Note and everything.

While ES6 is still being standardized and all the browsers are still working on supporting all the different features, it's worth getting a head start because Angular 2.0 will be based on ECMAScript 6 in the future when it's released. Thanks to Tracer, we can start playing around with ES6 features today as well as some of the things that Angular has started releasing, like DI, that already use ES6.

In the future, we'll also get to the ECMAScript 6+ that AngularJS 2.0 will work with, which adds things like annotations and some sort of typing. It's kind of what like does by compiling the static-type JavaScript down to JavaScript.

After you install Tracer using npm install Tracer using the -g global flag or not. Here I did and I just used Tracer to output this file, which is an ES6 file, to this Tracer-compiled file. Again, this is the JavaScript of today, the one that's being output, and this is ES6.

npm install tracer -g

Now, the file that this outputs is the file you'll want to use with the Tracer runtime, so you'll include the Tracer runtime first and then include the output file. Then the browser will be able to use this file just fine. Again, you're not using the ES6 file. You're using the output Tracer-compiled file. Then loading the Tracer runtime and then loading your own compiled file.

 If instead of using the , you want to invoke that file with node, simply use Tracer, and instead of using it to compile you can use it to run the output file and then run through the Tracer-compiled file using Tracer as the "runtime."

While installing Tracer is as easy as npm install Tracer, if you want to jump right in, you can just open ES6 Fiddle in your browser and load one of the examples. Then hit run and you can begin playing with ES6 right away.

Basically behind the scenes, this is compiling this to a Tracer-compiled file and then running it through Tracer to give you what the output of the console is.

 

转载地址:http://fvrfm.baihongyu.com/

你可能感兴趣的文章
react-native-storage + AsyncStorage 实现数据存储
查看>>
Cobaltstrike、armitage联动
查看>>
pandas set_index和reset_index的用法
查看>>
[Bash] View Files and Folders in Bash
查看>>
PEACHPIE 0.9.11 版本发布,可以上生产了
查看>>
异常检测——局部异常因子(Local Outlier Factor ,LOF)算法
查看>>
记录一次广州白云区项目数据库连接失败问题的解决过程
查看>>
干货:Vue粒子特效(vue-particles插件)
查看>>
Silverlight自定义数据绑定控件应该如何处理IEditableObject和IEditableCollectionView对象...
查看>>
加密PDF为只读模式
查看>>
让你编写的控件库在 XAML 中有一个统一的漂亮的命名空间(xmlns)和命名空间前缀...
查看>>
MySQL数据库的锁详解【转】
查看>>
ip route 解释
查看>>
【转】Android中保持Service的存活
查看>>
Consul功能简介
查看>>
IdentityServer4实战 - API与IdentityServer的交互过程解析
查看>>
Delphi编程 -- 使用CPUID指令获取CPU信息(转自大富翁)
查看>>
Android setRequestedOrientation用法
查看>>
面向对象三大基本特性,五大基本原则
查看>>
更改窗口图标并将其显示在任务栏
查看>>