O'Reilly logo

jQuery Design Patterns by Thodoris Greasidis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required