I'm in the process of refactoring my spaghetti jQuery code into components. So far, I've constructed one component, which is encapsulated in a self-fireing function.
$(document).ready(function () {
debugger;
});
(function () {
Component.init();
var Component = {
init: function () {
this.cacheDom();
this.bindEvents();
debugger;
},
cacheDom: function () {
//Initialize properties
},
bindEvents: function () {
//setup eventhandlers
},
function1: function (event) {
//do some work here
},
};
})();
My jQuery is hitting the dom.ready function, but my self-executing function is not doing anything. Also, I did try to remove the self-executing function and initialize the component in my $(document).ready(function) but it is not hitting the debugger that I have put inside the init function..
I have looked through my code multiple times, and can't seem to figure out why the Component is not initialized at all.