JavaScript was initially conceived to enrich server-generated HTML pages with JavaScript widgets, including date pickers, autocomplete, tabs, and so on. With the increase in available internet bandwidth, and the enhanced computational power of desktops, laptops, mobile devices, and smartphones, in order to ensure faster responses to all user inputs, and to be in a position to better exploit all available resources, increasingly, application logic moved from the server-side to JavaScript code on the client machine. This was the case until the diffusion of single-page applications, where the entire application logic runs in JavaScript on the client machine and the server's role is limited to handling shared data, as well as authentication/authorization logic.
The increasing complexity of JavaScript code bases led to the definition of new JavaScript specifications and toolsets to bring JavaScript from the level of a scripting language to that of modern object-oriented languages, such as Java, C#, and C++. Among the significant changes and tools, the following are worthy of mention:
- The new ECMAScript 6 specifications that turn JavaScript into an advanced object-oriented language.
- The new TypeScript language that adds types to JavaScript to enable better compilation-time checks, and implements almost all new ECMAScript 6 features that are not yet supported by all browsers. What makes TypeScript great is that it is JavaScript of the future plus types, and that it transpiles to browser-compatible JavaScript.
- JavaScript library repositories, such as NPM, that are capable of automatically tracking dependencies among libraries.
- JavaScript test frameworks, such as Jasmine.
- The organization of JavaScript code into modules, and the usage tools called bundlers that facilitate the linking of several interdependent modules into a few JavaScript files to add to each HTML page.
- Frameworks, such as Angular, that contain everything needed to implement single-page applications.
Somewhat unfortunately, knowledge of these subjects is spread across a variety of locations, so it is very frustrating when you come to write modern rich-client web applications. For instance, if you decide to learn Angular, you'll discover that you need to learn TypeScript beforehand, and then you'll discover that a knowledge of TypeScript is not enough either, because you also need to learn more about ECMAScript 6 and JavaScript modules. Finally, if you have resisted hitherto, you'll discover that you also need to learn about bundling and WebPack.
This book consolidates in a single place all the knowledge you require to implement a modern rich-client web application using a non-trivial JavaScript/TypeScript code base—TypeScript, ECMAScript 6 features, JavaScript modules, TypeScript library development and testing, bundling modules with WebPack, and the Angular single-page application framework.