Created
September 25, 2012 11:18
-
-
Save jamesflorentino/3781201 to your computer and use it in GitHub Desktop.
Template for defining a JavaScript module.
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
(function() { | |
var TestModule = (function() { | |
function Module() { | |
/** constructor **/ | |
} | |
/** prototype methods **/ | |
Module.prototype = { | |
create : function() {}, | |
read : function() {}, | |
update : function() {}, | |
delete : function() {} | |
} | |
return Module; | |
})(); | |
// For AMD libraries like RequireJS. | |
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { | |
define(function() { | |
return TestModule; | |
}); | |
} | |
// For Node.js and Ringo.js | |
if (typeof module == 'object' && module) { | |
module.exports = TestModule; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment