Currently I have this structure:
(function(myScope) {
myScope.public = function() {alert(\"I\'m public!\")};
myScope.privileged = function() {alert(\"I can c
You will need to break your code down into smaller parts. For each thing, you might want to make the instance reference local-scoped, but you can import the class/code/functionality from a different file.
Blowing up your example to three files:
function makeAlerter(state) {
return function() {
alert("I'm "+state);
};
}
(function(myScope) {
var private = makeAlerter("private"); // not the whole private coding here
myScope.privileged = function() { // but the privileged code needs to stay
alert("I can call private!"); private();
};
})(window.myObj);
(function(myScope) {
myScope.public = function() {alert("I'm public!")};
})(window.myObj);