Created
March 31, 2015 23:10
-
-
Save TrevorJTClarke/7f904ee0289570bae80d to your computer and use it in GitHub Desktop.
A standard for building javascript modules -- pre-ES6
This file contains hidden or 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
/** | |
* Module Starter | |
*/ | |
var NS = "ModuleName"; | |
// load the module into global | |
window[NS] = (function(){ | |
/** | |
* Internal - encapsulates all logic | |
* | |
* Arguments | |
* options: provides entry method for any needed arguments | |
*/ | |
function Internal (options) { | |
options = options || {}; | |
// extra starting functions | |
} | |
// extend the Internal methods | |
Internal.prototype = { | |
get: function () { | |
console.log("get method"); | |
} | |
}; | |
// assign the Internal function to external methods | |
return new Internal(); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment