(modId, depsIds, factory)
| 153 | |
| 154 | // Simplify the logic. don't support id. |
| 155 | function define(modId, depsIds, factory) { |
| 156 | if (factory == null) { |
| 157 | // define(function () {}); |
| 158 | if (depsIds == null) { |
| 159 | factory = modId; |
| 160 | modId = null; |
| 161 | } |
| 162 | else { |
| 163 | // define('modId', function () {}); |
| 164 | factory = depsIds; |
| 165 | depsIds = null; |
| 166 | // define(['depsId'], function () {}); |
| 167 | if (modId instanceof Array) { |
| 168 | depsIds = modId; |
| 169 | modId = null; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if (modId) { |
| 175 | mods[modId] = invokeFactory(factory, loadDeps(depsIds)); |
| 176 | } |
| 177 | else { |
| 178 | currentDefinedFactory = factory; |
| 179 | currentDefinedDeps = loadDeps(depsIds || []); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | function loadMod(modId) { |
| 184 | if (!mods[modId]) { |
no test coverage detected
searching dependent graphs…