Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View module.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
var app = (function(){
var myPrivateVariable = "My private content";
var __private = {
bind: function(){
},
cache: function() {
// impl
}
};
var app = {
init: function(){
console.log(myPrivateVariable);
__private.cache();
__private.bind();
},
blabla: function(){
// ....
}
};
return app;
})();
 
app.init(); // > my private content
app.myPrivateVariable; // > undefined

Thanks for sharing this, its awesome!

I really like this approach!
However, I'd rather improve the public API in this case. Why are the functions "cache" and "bind" public?

What do you think?

@albiere makes sense. Updated! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.