The Module Pattern

The key concept of the basic Module Pattern is to provide a simple function, class, or object that the rest of the application can use, through a well-known variable name. It enables us to provide a minimal API for a Module, by hiding the parts of the implementation that do not need to be exposed. This way, we also avoid polluting the Global Namespace with variables and utility functions that are needed for internal use by our Module.

The IIFE building block

In this subsection, we will get a small introduction to the IIFE Design Pattern since it's an integral part for all the variants of the Module Pattern that we will see in this chapter. The Immediately Invoked Function Expression (IIFE) is a very commonly used Design Pattern ...

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.