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