Return to Snippet

Revision: 6142
at April 30, 2008 12:12 by twoism


Initial Code
if (typeof MyApp !== 'object') (function () { 
	// Public Methods
	window.doPrivateMethod  = function (boo) {
		MyApp.privateMethod(boo);
	} 
	// Private Vars
	var MyApp = {
		init:function() {
			console.log(this);
		},
		privateMethod:function(res) {
			console.log('Called Private Method with ' + res);
		}
	};
	return MyApp.init();
})();

Initial URL

                                

Initial Description

                                

Initial Title
Javascript: Private object with a public accessor

Initial Tags
javascript, object

Initial Language
JavaScript