Created
November 29, 2012 18:53
-
-
Save jesgundy/4171103 to your computer and use it in GitHub Desktop.
Vanilla JS module structure
This file contains 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
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