Skip to content

Instantly share code, notes, and snippets.

@jesgundy
Created November 29, 2012 18:53
Show Gist options
  • Save jesgundy/4171103 to your computer and use it in GitHub Desktop.
Save jesgundy/4171103 to your computer and use it in GitHub Desktop.
Vanilla JS module structure
var MyModule = (function() {
var ModuleExport = function() {
// Do constructor stuff.
};
ModuleExport.prototype = {
doStuff: function( param ) {
// do stuff, then...
this.doOtherStuff();
},
doOtherStuff: function() {
// Do other stuff
}
};
// Export a single instance or constructor
// return ModuleExport;
return new ModuleExport();
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment