/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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(); })();