You forgot to declare "privatePageLoad" with var
. Thus, it's a global variable.
You could also use a function declaration statement:
mymap['230'] = (function () {
function privatePageLoad(nid, page){
console.log('PAGE LOAD from 230: '+nid);
}
function handleDocummentAdded() {
console.log("New Document in 230!");
privatePageLoad(230, 0);
};
return {
newDocument: handleDocummentAdded
}
})();
Also, get into the habit of putting
"use strict";
at the top of your code. That would have resulted in an error in this case.