Skip to content

Instantly share code, notes, and snippets.

@FiNGAHOLiC
Created January 13, 2012 12:54
Show Gist options
  • Save FiNGAHOLiC/1605960 to your computer and use it in GitHub Desktop.
Save FiNGAHOLiC/1605960 to your computer and use it in GitHub Desktop.
Facade Pattern
// http://speakerdeck.com/u/addyosmani/p/large-scale-javascript-application-architecture
var module = (function(){
var _private = {
i : 5,
get : function(){
console.log('current value:' + this.i);
},
set : function(val){
this.i = val;
},
run : function(){
console.log('running');
},
jump : function(){
console.log('jumping');
}
};
return {
facade : function(args){
_private.set(args.val);
_private.get();
if(args.run){
_private.run();
};
};
};
}());
module.facade({ run : true, val : 10 }); // outputs current value:10, running
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment