(id, deps, factory)
| 12110 | |
| 12111 | //Create a define function specific to the module asking for amdefine. |
| 12112 | function define(id, deps, factory) { |
| 12113 | if (Array.isArray(id)) { |
| 12114 | factory = deps; |
| 12115 | deps = id; |
| 12116 | id = undefined; |
| 12117 | } else if (typeof id !== 'string') { |
| 12118 | factory = id; |
| 12119 | id = deps = undefined; |
| 12120 | } |
| 12121 | |
| 12122 | if (deps && !Array.isArray(deps)) { |
| 12123 | factory = deps; |
| 12124 | deps = undefined; |
| 12125 | } |
| 12126 | |
| 12127 | if (!deps) { |
| 12128 | deps = ['require', 'exports', 'module']; |
| 12129 | } |
| 12130 | |
| 12131 | //Set up properties for this module. If an ID, then use |
| 12132 | //internal cache. If no ID, then use the external variables |
| 12133 | //for this node module. |
| 12134 | if (id) { |
| 12135 | //Put the module in deep freeze until there is a |
| 12136 | //require call for it. |
| 12137 | defineCache[id] = [id, deps, factory]; |
| 12138 | } else { |
| 12139 | runFactory(id, deps, factory); |
| 12140 | } |
| 12141 | } |
| 12142 | |
| 12143 | //define.require, which has access to all the values in the |
| 12144 | //cache. Useful for AMD modules that all have IDs in the file, |
no test coverage detected