Update umd.js.

This commit is contained in:
Rico Sta. Cruz 2014-06-21 10:58:36 +08:00
parent 02e806e4ed
commit 1a950be6a8
1 changed files with 19 additions and 2 deletions

View File

@ -3,7 +3,7 @@ title: Universal JS module loader
layout: default
---
### Basic (with dependency)
### [With dependency](https://github.com/umdjs/umd/blob/master/amdWebGlobal.js)
~~~ js
;(function (root, factory) {
@ -21,7 +21,7 @@ layout: default
}));
~~~
### Basic (no dependency)
### No dependencies
~~~ js
;(function (root, factory) {
@ -39,6 +39,23 @@ layout: default
}));
~~~
### [Supports circular references](https://github.com/umdjs/umd/blob/master/commonjsStrict.js)
~~~ js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'jquery'], factory);
} else if (typeof exports === 'object') {
factory(exports, require('jquery'));
} else {
factory((root.YourModule = {}), root.jQuery);
}
}(this, function (exports, jQuery) {
exports.action = function () {};
}));
~~~
### Reference