Browse Source

优化一下

es6
guy 3 years ago
parent
commit
a0cb462ae3
  1. 8
      src/core/6.inject.js

8
src/core/6.inject.js

@ -15,6 +15,9 @@
for (var k in moduleInjectionMap) { for (var k in moduleInjectionMap) {
if (cls[k]) { if (cls[k]) {
for (key in cls[k]) { for (key in cls[k]) {
if (!moduleInjectionMap[k]) {
continue;
}
if (!moduleInjectionMap[k][key]) { if (!moduleInjectionMap[k][key]) {
moduleInjectionMap[k][key] = []; moduleInjectionMap[k][key] = [];
} }
@ -108,7 +111,8 @@
for (var j = 0; j < modules.length; j++) { for (var j = 0; j < modules.length; j++) {
var module = modules[i]; var module = modules[i];
if (module && dependencies[module.moduleId] && module.version === version) { if (module && dependencies[module.moduleId] && module.version === version) {
var minVersion = dependencies[module.moduleId].minVersion, maxVersion = dependencies[module.moduleId].maxVersion; var minVersion = dependencies[module.moduleId].minVersion,
maxVersion = dependencies[module.moduleId].maxVersion;
if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) { if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) {
findVersion = true; findVersion = true;
break; break;
@ -120,7 +124,7 @@
} }
} }
if (findVersion === true) { if (findVersion === true) {
_global.console && console.error("module: [" + type + "] 版本: [" + module.version + "] 已过期"); _global.console && console.error("moduleId: [" + module.moduleId + "] 服务: [" + type + "] 版本: [" + module.version + "] 已过期", modelInjection[module.moduleId]);
continue; continue;
} }
} }

Loading…
Cancel
Save