Recently I've been getting into Anonymous functions in a big way and wondering how this is possible as I'm trying to re-arrange my JS code-base.
(function (listLoad, $, undefined) {
listLoad.create = function(data)
{
this.init = function(data)
{
}
}
} (window.listLoad = window.listLoad || {}, jQuery));
What I'm looking to do is obviously have a number of functions for my "listLoad" page, such as "dataMap" etc, in which will all have init functions for initializing the page.
My main question is how do I access this .init function? I'm guessing it's of private scope. I've tried:
listLoad.create.init = function(data)
and
create.init = function(data)
and even init = function(data)
All to no success when writing
listLoad.create.init();
How to do this? I'm more than happy to hear certain suggestions on architecture too if you feel I'm going the wrong way about my scenario.