Last active
August 29, 2015 14:04
-
-
Save bishopZ/f44dca19d22b9de96958 to your computer and use it in GitHub Desktop.
Require.js & CommonJS & Node compatible module creation
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
function(name, root, factory){ | |
if (typeof define !== 'undefined' && define.amd) { | |
define(name, ['dependency'], factory); | |
} else if (typeof exports !== 'undefined') { | |
if (typeof module !== 'undefined' && module.exports) { | |
exports = module.exports = factory; | |
} | |
exports[name] = factory; | |
} else { | |
root[name] = factory; | |
} | |
})('myModule', window||this||{}, function(){ | |
var myModule = function(){}; | |
// ... write your module code here ... \\ | |
return myModule; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment