2 title: Universal JS module loader
3 category: JavaScript libraries
6 ### [With dependency](https://github.com/umdjs/umd/blob/master/amdWebGlobal.js)
9 ;(function (root, factory) {
11 if (typeof define === 'function' && define.amd) {
12 define(['jquery'], factory);
13 } else if (typeof exports === 'object') {
14 module.exports = factory(require('jquery'));
16 root.YourModule = factory(root.jQuery);
19 }(this, function (jquery) {
27 ;(function (root, factory) {
29 if (typeof define === 'function' && define.amd) {
31 } else if (typeof exports === 'object') {
32 module.exports = factory();
34 root.YourModule = factory();
42 ### [Supports circular references](https://github.com/umdjs/umd/blob/master/commonjsStrict.js)
45 (function (root, factory) {
47 if (typeof define === 'function' && define.amd) {
48 define(['exports', 'jquery'], factory);
49 } else if (typeof exports === 'object') {
50 factory(exports, require('jquery'));
52 factory((root.YourModule = {}), root.jQuery);
55 }(this, function (exports, jQuery) {
56 exports.action = function () {};
62 * https://github.com/umdjs/umd