MCPcopy
hub / github.com/apache/echarts / loadMod

Function loadMod

test/lib/simpleRequire.js:183–214  ·  view source on GitHub ↗
(modId)

Source from the content-addressed store, hash-verified

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) {

Callers 1

loadDepsFunction · 0.85

Calls 5

resolvePathFunction · 0.85
getExtFunction · 0.85
loadScriptFunction · 0.85
loadJSONFunction · 0.85
loadTextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…