MCPcopy Create free account
hub / github.com/apache/cloudstack / loadModules

Function loadModules

tools/ngui/static/js/lib/angular.js:2800–2841  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

2798 // Module Loading
2799 ////////////////////////////////////
2800 function loadModules(modulesToLoad){
2801 var runBlocks = [];
2802 forEach(modulesToLoad, function(module) {
2803 if (loadedModules.get(module)) return;
2804 loadedModules.put(module, true);
2805 if (isString(module)) {
2806 var moduleFn = angularModule(module);
2807 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
2808
2809 try {
2810 for(var invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
2811 var invokeArgs = invokeQueue[i],
2812 provider = invokeArgs[0] == '$injector'
2813 ? providerInjector
2814 : providerInjector.get(invokeArgs[0]);
2815
2816 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
2817 }
2818 } catch (e) {
2819 if (e.message) e.message += ' from ' + module;
2820 throw e;
2821 }
2822 } else if (isFunction(module)) {
2823 try {
2824 runBlocks.push(providerInjector.invoke(module));
2825 } catch (e) {
2826 if (e.message) e.message += ' from ' + module;
2827 throw e;
2828 }
2829 } else if (isArray(module)) {
2830 try {
2831 runBlocks.push(providerInjector.invoke(module));
2832 } catch (e) {
2833 if (e.message) e.message += ' from ' + String(module[module.length - 1]);
2834 throw e;
2835 }
2836 } else {
2837 assertArgFn(module, 'module');
2838 }
2839 });
2840 return runBlocks;
2841 }
2842
2843 ////////////////////////////////////
2844 // internal Injector

Callers 1

createInjectorFunction · 0.85

Calls 9

forEachFunction · 0.85
isStringFunction · 0.85
isFunctionFunction · 0.85
isArrayFunction · 0.85
assertArgFnFunction · 0.85
getMethod · 0.65
applyMethod · 0.65
putMethod · 0.45
invokeMethod · 0.45

Tested by

no test coverage detected