-
Book Overview & Buying
-
Table Of Contents
Typescript essentials
By :
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...
Change the font size
Change margin width
Change background colour