In this chapter, we explored several advanced techniques for using Backbone. First, we learned how many of Backbone's properties can be replaced with methods, and in particular, how the model
property of a Collection
class can be used in this way to generate different types of Models
. We then learned how to override a class constructor
to gain access to and/or manipulate its arguments before initialize
, and how to use mixins to share methods between otherwise unrelated classes. Finally, we examined how to use the Backbone object itself to implement the pub/sub pattern, and how Backbone Views
can be used to "wrap" components from other JavaScript libraries.
In the next chapter, we'll look at some of the performance implications of Backbone and how you can avoid the most common performance pitfalls.