Javascript Namespace
by kontrax
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
//Self-Executing Anonymous Function (Namespace) (Public & Private)
(function( public, undefined ) {
//Private Properties
var property = "property";
//Public Properties
public.property = "public.property";
//Public Run Method
public.Run = function() {
console.log( "public.Run" );
this.Method();
};
//Public Methods
public.Method = function() {
console.log( "public.Method" );
console.log( this.property );
Method();
};
//Private Methods
function Method() {
console.log( "Method" );
console.log( property );
}
// CONSTRUCTION
}(
window.Namespace = window.Namespace || {}
));
Namespace.Run()