Created
May 11, 2011 13:08
-
-
Save jed/966418 to your computer and use it in GitHub Desktop.
Simple prototype pattern
This file contains hidden or 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
Widget = new function() { | |
function MyThing() { | |
var privateInstanceMember = "..." | |
, privateInstanceMethod = function(){ ... } | |
this.instanceMember = "..." | |
this.instanceMethod = function(){ ... } | |
} | |
var privateProtoMember = "..." | |
, privateProtoMethod = function(){ ... } | |
this.protoMember = "..." | |
this.protoMethod = function(){ ... } | |
Widget.prototype = this | |
return Widget | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment