Skip to content

Instantly share code, notes, and snippets.

@weslleyaraujo
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weslleyaraujo/cdb03c878516f1dccb14 to your computer and use it in GitHub Desktop.
Save weslleyaraujo/cdb03c878516f1dccb14 to your computer and use it in GitHub Desktop.
Pattern for private methods using prototype
var ClassName = (function () {
var
// here is the place to inject private methods
_private = {},
// all attributes values goes here
attributes = {
};
function ClassName (args) {
args = args || {};
this.initialize(args);
}
_private = {
};
ClassName.prototype.initialize = function (args) {
this.args = args;
this.set();
};
ClassName.prototype.set = function () {
};
return ClassName;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment