Chapter 6. Inter-module interaction

This chapter covers

  • A review of modules
  • Interaction between modules
  • Using module dependencies
  • Using the publish/subscribe pattern

In chapter 3, you learned a great deal about modular programming. One of the biggest takeaways from that chapter is the idea that you can internalize the complexity of your code and provide a public API to its features by applying an architectural design pattern commonly referred to as the module pattern. This is a way to achieve encapsulation in JavaScript.

As you discovered, coding with modules helps organize your application’s logic into small, single-purpose units, which are easier to maintain and update. This inevitably leads to greater reusability for your code. Using ...

Get SPA Design and Architecture: Understanding single-page web applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.