Defining Modules

Learn how to centralize an application into separate modules and add functions to access the modules in Marionette.

Defining a module

Now, we’ll move our contacts to a separate module. That way, we can centralize their management, and when our app needs the contact data, it can simply request it.

Let’s start by creating a new Marionette module:

Press + to interact
ContactManager.module("Entities", function(Entities, ContactManager,
Backbone, Marionette, $, _){
});

Note: Lines 1 and 2 are actually a single line in our application, but are displayed across two lines for better readability. We will often ...