I namespace my models and a single controller like this:
var MC = {};
and then added properties as needed.
For example, the code th
you can do this with closures.
var MyNamespace = {};
MyNamespace.MyClass = (function() {
function privateMethod() {
// ...
}
function publicMethod() {
// can call privateMethod() from in here
}
return ({
publicMethod: publicMethod
});
}());
This will create an object called MyNamespace.MyClass
with one private method and one public method. In your case you probably want to do this for each model class. Have their init
methods be public and hide their other methods.