MCPcopy
hub / github.com/jquery/esprima / loadModules

Function loadModules

test/3rdparty/angular-1.2.5.js:3587–3628  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

3585 // Module Loading
3586 ////////////////////////////////////
3587 function loadModules(modulesToLoad){
3588 var runBlocks = [], moduleFn, invokeQueue, i, ii;
3589 forEach(modulesToLoad, function(module) {
3590 if (loadedModules.get(module)) return;
3591 loadedModules.put(module, true);
3592
3593 try {
3594 if (isString(module)) {
3595 moduleFn = angularModule(module);
3596 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
3597
3598 for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
3599 var invokeArgs = invokeQueue[i],
3600 provider = providerInjector.get(invokeArgs[0]);
3601
3602 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
3603 }
3604 } else if (isFunction(module)) {
3605 runBlocks.push(providerInjector.invoke(module));
3606 } else if (isArray(module)) {
3607 runBlocks.push(providerInjector.invoke(module));
3608 } else {
3609 assertArgFn(module, 'module');
3610 }
3611 } catch (e) {
3612 if (isArray(module)) {
3613 module = module[module.length - 1];
3614 }
3615 if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
3616 // Safari & FF's stack traces don't contain error.message content
3617 // unlike those of Chrome and IE
3618 // So if stack doesn't contain message, we create a new string that contains both.
3619 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
3620 /* jshint -W022 */
3621 e = e.message + '\n' + e.stack;
3622 }
3623 throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
3624 module, e.stack || e.message || e);
3625 }
3626 });
3627 return runBlocks;
3628 }
3629
3630 ////////////////////////////////////
3631 // internal Injector

Callers 1

createInjectorFunction · 0.85

Calls 7

isStringFunction · 0.85
isFunctionFunction · 0.85
isArrayFunction · 0.85
assertArgFnFunction · 0.85
pushMethod · 0.80
forEachFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…