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

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.

主站蜘蛛池模板: 沾益县| 凤山市| 阿合奇县| 新闻| 遂平县| 朔州市| 赣榆县| 华蓥市| 富川| 巢湖市| 沙田区| 晋州市| 三门县| 上栗县| 宜城市| 湖州市| 永定县| 微山县| 通海县| 华容县| 广安市| 泌阳县| 舟山市| 双江| 灵武市| 吉木萨尔县| 吉安县| 嘉鱼县| 罗城| 监利县| 唐河县| 勃利县| 吴堡县| 开封县| 礼泉县| 岳西县| 沽源县| 凌云县| 通辽市| 丰城市| 彭山县|