Summary

In this chapter, we were introduced to the Publish/Subscribe Pattern. We saw its similarities with the Observer Pattern and also learned its benefits by doing a comparison of the two. We analyzed how the more distinct roles and the extra features that the Publish/Subscribe Pattern offers make it an ideal pattern for more complex use cases. We saw how jQuery developers adopted some of its concepts and brought them to their Observer Pattern implementation as custom events. Finally, we rewrote the example from the previous chapter using the Publish/Subscribe Pattern, adding some extra features and also achieving greater decoupling between the different parts and page elements of our application.

Now that we have completed our introduction ...

Get jQuery Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.