Skip to content

Instantly share code, notes, and snippets.

@CatTail
Last active January 17, 2016 04:22
Show Gist options
  • Save CatTail/5775203 to your computer and use it in GitHub Desktop.
Save CatTail/5775203 to your computer and use it in GitHub Desktop.
Cross plantform module export
(function() {
var root = this;
// AMD / RequireJS
if (typeof define !== 'undefined' && define.amd) {
define('modulename', [], function () {
return global;
});
}
// Node.js
else if (typeof module !== 'undefined' && module.exports) {
module.exports = global;
}
// included directly via <script> tag
else {
root.modulename = global;
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment