Skip to content

Instantly share code, notes, and snippets.

@FiNGAHOLiC
Created January 13, 2012 12:29
Show Gist options
  • Save FiNGAHOLiC/1605878 to your computer and use it in GitHub Desktop.
Save FiNGAHOLiC/1605878 to your computer and use it in GitHub Desktop.
Module pattern (YUI)
// http://speakerdeck.com/u/addyosmani/p/large-scale-javascript-application-architecture
YAHOO.store.basket = function(){
var myPrivateVar = 'I can accessed only within YAHOO.store.basket.';
var myPrivateMethod = function(){
YAHOO.log('I can be accessed only from within YAHOO.store.basket.');
};
return {
myPublicProperty : 'I am a public property.',
myPublicMethod : function(){
YAHOO.log('I am a public method.');
YAHOO.log(myPrivateVar);
YAHOO.log(myPrivateMethod());
YAHOO.log(this.myPublicProperty);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment