Now that we have converted our application to use AMD modules, let's gradually increase the complexity of the application. Currently, we search the DOM for individual elements and attach event handlers to them. This isn't necessarily a bad thing; however, it does leave our code vulnerable to a number of possible issues. The DOM may not have finished rendering the objects we are attempting to attach to, or the object could have been removed by another segment of code. Another pitfall of this approach is that if we wanted to add another drawing shape type to our application, we would have to add another element to the HTML and then more code to add the event handler. This is inefficient and could open up the possibility of making a mistake somewhere. Fortunately, there are a number of libraries available that allow us to implement binding patterns such as Model View Controller (MVC) and Model View ViewModel (MVVM). Knockout is one of these libraries, and it brings...

TypeScript Essentials
By :

TypeScript Essentials
By:
Overview of this book
Table of Contents (15 chapters)
TypeScript Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Getting Started with TypeScript
TypeScript Basics
The TypeScript Compiler
Object-oriented Programming with TypeScript
Creating a Simple Drawing Application
Declaration Files and Library Integrations
Enhancing the Drawing Application
Debugging TypeScript
Index
Customer Reviews