Skip to content

Instantly share code, notes, and snippets.

@simme
Created March 6, 2014 19:45
Show Gist options
  • Save simme/9397874 to your computer and use it in GitHub Desktop.
Save simme/9397874 to your computer and use it in GitHub Desktop.
(function () {
var Foobar = function MyModule() { /* ... */ };
var hasDefine = typeof define === 'function' && define.amd;
var hasExport = typeof exports !== 'undefined';
if (hasDefine) {
define('Foobar', Foobar);
}
else if (hasExport) {
exports = Foobar;
}
else {
window.Foobar = Foobar;
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment