Browse Source

优化一下

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

18
src/core/6.inject.js

@ -13,8 +13,11 @@
}
var key;
for (var k in moduleInjectionMap) {
if(cls[k]){
if (cls[k]) {
for (key in cls[k]) {
if (!moduleInjectionMap[k]) {
continue;
}
if (!moduleInjectionMap[k][key]) {
moduleInjectionMap[k][key] = [];
}
@ -103,24 +106,25 @@
var conf = queue[i];
var version = conf.opt.version;
var fn = conf.fn;
if(modules && version) {
if (modules && version) {
var findVersion = false;
for (var j = 0; j < modules.length; j++) {
var module = modules[i];
if (module && dependencies[module.moduleId] && module.version === version) {
var minVersion = dependencies[module.moduleId].minVersion, maxVersion = dependencies[module.moduleId].maxVersion;
if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion){
var minVersion = dependencies[module.moduleId].minVersion,
maxVersion = dependencies[module.moduleId].maxVersion;
if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) {
findVersion = true;
break;
}
if(maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion){
if (maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion) {
findVersion = true;
break;
}
}
}
if(findVersion === true){
_global.console && console.error("module: [" + type + "] 版本: [" + module.version + "] 已过期");
if (findVersion === true) {
_global.console && console.error("moduleId: [" + module.moduleId + "] 服务: [" + type + "] 版本: [" + module.version + "] 已过期", modelInjection[module.moduleId]);
continue;
}
}

Loading…
Cancel
Save