Douglas Crockford’s Javascript Pattern
I keep forgetting this and having to look for it, so I’m recording it here for easy future access:
myModule = function () {
var myPrivateVar;
var myPrivateMethod = function () { }
return {
myPublicProperty: "something",
myPublicMethod: function () { }
};
}();
Manage your expenses via Email, SMS, iPhone, Twitter, Voice (Call and say your expense), IM (Yahoo, AIM, MSN), or Web.
Comments(1)
Thanks for the reminder! I just told Emacs to auto-populate new .js files with this.