GlobalData module
As the name implies, this module is designed to store application level data and act as the model for our application. It also provides public methods so that other modules can get and set data in the module. This module is defined as ImagesInc_GlobalData
global variable in the application..
The following shows a snippet of the kind of data that the module stores:
var favCookieName = "Images_Inc", pageDefintionsFile = "PageDefinitions.js", pageDefinitionsFilePath = "js/Modules/PageDefinitions/", ...
This module is augmented with a sub-module ImagesInc_PageSections
, which stores HTML markup strings related to header
and footer
components.
It is worth looking at how this sub-module is added to GlobalData
module.
var ImagesInc_GlobalData = ImagesInc_GlobalData || null; var ImagesInc_PageSections = (function(mainModule, subModule){ // assigning the subModule if it is passed in and also augmenting sub-module var pageSections = mainModule.pageSections ...