I recently started at an environment where the sub module method of JS programming is used exclusively throughout the application. Coming from the wild west of advertising however, I am having a hard time wrapping my head around it. I understand the concepts, which is why it's so frustrating that the following alert never fires:
customNamespace.anotherCustomVar = (function ($, customNamespace) {
return {
init : function () {
alert(''); // Doesn't fire
}
};
})( jQuery, customNamespace );
Looking at another file almost exactly like this, putting an alert in the init fn works fine.
customNamespace.aDifferentCustomVar = (function ($, customNamespace) {
return {
init : function () {
alert(''); // Does fire
}
};
})( jQuery, customNamespace );
These are separate js files in the same directory fyi. Does it have something to do with my anotherCustomVar name, if aDifferentCustomVar works?