(modId)
| 181 | } |
| 182 | |
| 183 | function loadMod(modId) { |
| 184 | if (!mods[modId]) { |
| 185 | mods[modId] = {}; |
| 186 | |
| 187 | function loaded(exports) { |
| 188 | var ret; |
| 189 | if (currentDefinedDeps) { |
| 190 | ret = invokeFactory(currentDefinedFactory, currentDefinedDeps); |
| 191 | } |
| 192 | else { |
| 193 | ret = exports; |
| 194 | } |
| 195 | // Clear. |
| 196 | currentDefinedFactory = null; |
| 197 | currentDefinedDeps = null; |
| 198 | return ret; |
| 199 | } |
| 200 | |
| 201 | var url = resolvePath(modId); |
| 202 | var ext = getExt(url); |
| 203 | if (ext === 'js') { |
| 204 | mods[modId].exports = loadScript(url).then(loaded); |
| 205 | } |
| 206 | else if (ext === 'json' || ext === 'geojson') { |
| 207 | mods[modId].exports = loadJSON(url).then(loaded); |
| 208 | } |
| 209 | else { |
| 210 | mods[modId].exports = loadText(url).then(loaded); |
| 211 | } |
| 212 | } |
| 213 | return mods[modId].exports; |
| 214 | } |
| 215 | |
| 216 | function loadDeps(depsIds) { |
| 217 | return Promise.all(depsIds.map(function (depId) { |
no test coverage detected
searching dependent graphs…