This is my bootstrap:
LanesBoard2010 = (function () {
var appRoot = this;
appRoot.deferredLoad = new Object(); //holding jqxhr states
appRoot.utils = {}; //namespace for helper classes
appRoot.models = {};
appRoot.data = (function () { } ()); //store data from webservices here
appRoot.app = (function () { } ()); //ViewModel
}();
After some initialisation i run my deferred app loader:
function appStart() {
appRoot.deferredLoad.app = $.getScript('../TaskBoardContent/Script/app/lanesboard.js');
$.when.apply($, appRoot.deferredLoad.app).then(function () {
if (window.console)
if (debug)
console.log('application lanesdashboard was loaded successfully\n');
}, function () {
if (window.console)
if (debug)
console.log('fatal error: unable to load application lanesdashboard\n');
});
};
Now i need to access appRoot, or more general, modify the properties of LanesBoard2010.
the following statement is from my lanesboard.js. It just fails after the first console.log, as i can see both variable names are unknown:
(function () {
if (window.console)
if (true) {
console.log('App has been initialised successfully');
console.log('Status of app access 1: ' + appRoot);
console.log('Status of app access 2: ' + LanesBoard2010);
}
}());
May sound stupid, but how can i safely access my variables? Is there any best practice? How would you do this?