Skip to content

Instantly share code, notes, and snippets.

@Cycymomo
Created January 15, 2014 17:33
Show Gist options
  • Save Cycymomo/8440612 to your computer and use it in GitHub Desktop.
Save Cycymomo/8440612 to your computer and use it in GitHub Desktop.
wrapperUMD (compat CommonJS, AMD et others)
(function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('b'));
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['b'], function (b) {
return (root.returnExportsGlobal = factory(b));
});
} else {
// Global Variables
root.returnExportsGlobal = factory(root.b);
}
}(this, function (b) {
// Ici votre module (fonction, objet, whatever...)
return {};
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment