MCPcopy Create free account
hub / github.com/JacksonTian/fks / loadModules

Function loadModules

fks_chart/bower_components/angular/angular.js:3869–3910  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

3867 // Module Loading
3868 ////////////////////////////////////
3869 function loadModules(modulesToLoad){
3870 var runBlocks = [], moduleFn, invokeQueue, i, ii;
3871 forEach(modulesToLoad, function(module) {
3872 if (loadedModules.get(module)) return;
3873 loadedModules.put(module, true);
3874
3875 try {
3876 if (isString(module)) {
3877 moduleFn = angularModule(module);
3878 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
3879
3880 for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
3881 var invokeArgs = invokeQueue[i],
3882 provider = providerInjector.get(invokeArgs[0]);
3883
3884 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
3885 }
3886 } else if (isFunction(module)) {
3887 runBlocks.push(providerInjector.invoke(module));
3888 } else if (isArray(module)) {
3889 runBlocks.push(providerInjector.invoke(module));
3890 } else {
3891 assertArgFn(module, 'module');
3892 }
3893 } catch (e) {
3894 if (isArray(module)) {
3895 module = module[module.length - 1];
3896 }
3897 if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
3898 // Safari & FF's stack traces don't contain error.message content
3899 // unlike those of Chrome and IE
3900 // So if stack doesn't contain message, we create a new string that contains both.
3901 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
3902 /* jshint -W022 */
3903 e = e.message + '\n' + e.stack;
3904 }
3905 throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
3906 module, e.stack || e.message || e);
3907 }
3908 });
3909 return runBlocks;
3910 }
3911
3912 ////////////////////////////////////
3913 // internal Injector

Callers 1

createInjectorFunction · 0.85

Calls 4

forEachFunction · 0.85
isStringFunction · 0.85
isFunctionFunction · 0.85
assertArgFnFunction · 0.85

Tested by

no test coverage detected