Chapter 2. The Observer Pattern
In this chapter, we will showcase the Observer Pattern and the convenient way in which we can utilize it in our pages using jQuery. Later on, we will also explain the Delegated Event Observer Pattern variant, which when properly applied to web pages can lead to code simplifications and also lessen the memory consumption that a page requires.
In this chapter, we will:
- Introduce the Observer Pattern
- See how the Observer Pattern is used by jQuery
- Compare the Observer Pattern with using the event attributes
- Learn how to avoid memory leaks from observers
- Introduce the Delegated Event Observer Pattern and showcasing its benefits
Introducing the Observer Pattern
The key concept of the Observer Pattern is that there is an object, ...