Chapter 7. Fitting Square Pegs in Round Holes – Advanced Backbone Techniques

In this chapter, we will look at various advanced uses of Backbone, including the following:

  • Using methods in place of properties
  • Overriding a class's constructor
  • Using mixins to share logic between classes
  • Implementing the publish/subscribe pattern
  • Wrapping widgets from other libraries in Backbone Views

Taking it up a notch

In the previous chapters, we've discussed the basics of using Backbone's four classes, and while these basics are more than enough to make you productive with Backbone, we've deliberately left out a few of the more complicated details. In this chapter, we'll explore those left-out details and how they relate to certain advanced Backbone techniques.

Before we proceed, however, it is important to note that all of the techniques discussed in this chapter are intended to be used to solve specific problems, and not as general-purpose patterns. While there is certainly nothing "wrong" with using any of these techniques, they will make your code more complex and thus, less intuitive and harder to maintain. Thus, it is recommended that you avoid using any of the techniques discussed in this chapter unless you specifically need to do so to solve a particular problem.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.72.131