Skip to content

Instantly share code, notes, and snippets.

@antoniocapelo
Last active August 29, 2015 14:04
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 antoniocapelo/7614fb0cc74179ebfb80 to your computer and use it in GitHub Desktop.
Save antoniocapelo/7614fb0cc74179ebfb80 to your computer and use it in GitHub Desktop.
Class creation and export on JavaScript
(function() {
var ClassName, root;
function ClassName (config) {
var privateProperty = 24;
this.publicProperty = 42;
privateMethod = function (foo) {
// do stuff
return true;
}
this.publicMethod = function (foo, bar) {
// do stuff
console.log(config);
return cenas;
};
};
ClassName.prototype.anotherPublicMethod = function() {
// do stuff
return cenas;
};
root = typeof exports !== "undefined" && exports !== null ? exports : window;
root.ClassName = ClassName;
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment