Skip to content

Instantly share code, notes, and snippets.

@jed
Created May 11, 2011 13:08
Show Gist options
  • Save jed/966418 to your computer and use it in GitHub Desktop.
Save jed/966418 to your computer and use it in GitHub Desktop.
Simple prototype pattern
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