I have a class in Javascript based on this Base Class by Josh Gertzen. I'd like the class to self-execute an 'initialize' function for adding event listeners when it's instantiated. Is this possible?
This is in my main application script:
var mainView = new MainView(model)
/*the line I want to remove but don't know how*/
mainView.initialize();
And this is the method setting up the listener inside of the class extension.
initialize : function ()
{
$(document).on("Loading", this.addPreloader);
}
Any help would be really appreciated. Thank you!