MCPcopy Index your code
hub / github.com/binux/qiandao / loadModules

Function loadModules

web/static/components/angularjs/angular.js:3844–3885  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

3842 // Module Loading
3843 ////////////////////////////////////
3844 function loadModules(modulesToLoad){
3845 var runBlocks = [], moduleFn, invokeQueue, i, ii;
3846 forEach(modulesToLoad, function(module) {
3847 if (loadedModules.get(module)) return;
3848 loadedModules.put(module, true);
3849
3850 try {
3851 if (isString(module)) {
3852 moduleFn = angularModule(module);
3853 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
3854
3855 for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
3856 var invokeArgs = invokeQueue[i],
3857 provider = providerInjector.get(invokeArgs[0]);
3858
3859 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
3860 }
3861 } else if (isFunction(module)) {
3862 runBlocks.push(providerInjector.invoke(module));
3863 } else if (isArray(module)) {
3864 runBlocks.push(providerInjector.invoke(module));
3865 } else {
3866 assertArgFn(module, 'module');
3867 }
3868 } catch (e) {
3869 if (isArray(module)) {
3870 module = module[module.length - 1];
3871 }
3872 if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
3873 // Safari & FF's stack traces don't contain error.message content
3874 // unlike those of Chrome and IE
3875 // So if stack doesn't contain message, we create a new string that contains both.
3876 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
3877 /* jshint -W022 */
3878 e = e.message + '\n' + e.stack;
3879 }
3880 throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
3881 module, e.stack || e.message || e);
3882 }
3883 });
3884 return runBlocks;
3885 }
3886
3887 ////////////////////////////////////
3888 // internal Injector

Callers 1

createInjectorFunction · 0.85

Calls 6

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

Tested by

no test coverage detected