官术网_书友最值得收藏!

The evolution of ECMAScript

Nowadays, browser vendors are releasing new features in short iterations, and users receive updates quite often. This helps developers take advantage of bleeding-edge web technologies. ES2015 is already standardized. The implementation of the latest version of the language has already started in the major browsers. Learning the new syntax and taking advantage of it will not only increase our productivity as developers but will also prepare us for the near future when all browsers will have full support for it. This makes it essential to start using the latest syntax now.

The requirements of some projects may enforce us to support older browsers, which do not support any ES2015 features. In this case, we can directly write ECMAScript 5, which has a different syntax, but has semantics equivalent to ES2015. On the other hand, a better approach will be to take advantage of the process of transpilation. Using a transpiler in our build process allows us to take advantage of the new syntax by writing ES2015 and translating it to a target language that is supported by the browsers.

Angular has been around since 2009. Back then, the frontend of most websites was powered by ECMAScript 3—the last main release of ECMAScript before ECMAScript 5. This automatically meant that the language used for the implementation of the framework was ECMAScript 3. Taking advantage of the new version of the language requires porting of the entirety of AngularJS to ES2015.

From the beginning, Angular took into account the current state of the web by bringing the latest syntax in the framework. Angular is written with a superset of ES2016, called TypeScript, which we'll take a look at in Chapter 4, TypeScript Crash Course. The type annotations allow us to take additional performance boost because they open the door for a process called ahead-of-time (AOT) compilation, which as part of the build process, generates efficient code for change detection, rendering, and dependency injection. You can find more about AOT compilation in Chapter 9, Tooling and Development Experience.

主站蜘蛛池模板: 襄樊市| 新巴尔虎左旗| 疏勒县| 平凉市| 温泉县| 侯马市| 淮北市| 平邑县| 云龙县| 德令哈市| 松潘县| 石柱| 新闻| 玛纳斯县| 玛多县| 城固县| 宁乡县| 阿克陶县| 岳池县| 金坛市| 大厂| 武功县| 武汉市| 泽库县| 武宁县| 重庆市| 林西县| 永定县| 澄城县| 绥滨县| 兴业县| 禄丰县| 鸡泽县| 湘阴县| 龙陵县| 辽阳市| 连江县| 东兰县| 德令哈市| 秦皇岛市| 巴彦淖尔市|