My javascript looks like the following. I don’t understand why these methods are all public though?
Something.RegisterNamespace("One.ABC");
(function(ABC) {
ABC.SayHello = function() {
alert('hello');
};
})(One.ABC);
So now I can do:
One.ABC.SayHello();
You are adding the
SayHellofunction into the object being passed in, which isOne.ABC. What else are you expecting? If you want a private function, define it inside your anonymous function (var SayHello = function(){...}) without adding it to the object. Not sure what you’re trying to accomplish…EDIT:
Here’s how I would rewrite your code to do what I think you want: