Created
January 13, 2012 12:29
-
-
Save FiNGAHOLiC/1605878 to your computer and use it in GitHub Desktop.
Module pattern (YUI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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