Browse Source

Pull request #2292: 无jira任务 constant es6写法优化

Merge in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit '3ac34ba081240410bc92c66b069a8be31ce31c18':
  无jira任务 es6写法优化
  无jira任务 constant es6写法优化
es6
imp 3 years ago
parent
commit
ddd84b2f99
  1. 17
      src/core/6.inject.js

17
src/core/6.inject.js

@ -39,6 +39,9 @@
_global.console && console.error("constant: [" + xtype + "]已经注册过了"); _global.console && console.error("constant: [" + xtype + "]已经注册过了");
} }
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
return function () {
return BI.Constants.getConstant(xtype);
}
}; };
var modelInjection = {}; var modelInjection = {};
@ -47,6 +50,9 @@
_global.console && console.error("model: [" + xtype + "] 已经注册过了"); _global.console && console.error("model: [" + xtype + "] 已经注册过了");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
return function (xtype, config) {
return BI.Models.getModel(xtype, config);
};
}; };
var storeInjection = {}; var storeInjection = {};
@ -55,6 +61,9 @@
_global.console && console.error("store: [" + xtype + "] 已经注册过了"); _global.console && console.error("store: [" + xtype + "] 已经注册过了");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
return function (xtype, config) {
return BI.Stores.getStore(xtype, config);
}
}; };
var serviceInjection = {}; var serviceInjection = {};
@ -63,6 +72,9 @@
_global.console && console.error("service: [" + xtype + "] 已经注册过了"); _global.console && console.error("service: [" + xtype + "] 已经注册过了");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
return function (xtype, config) {
return BI.Services.getService(xtype, config);
}
}; };
var providerInjection = {}; var providerInjection = {};
@ -71,6 +83,9 @@
_global.console && console.error("provider: [" + xtype + "] 已经注册过了"); _global.console && console.error("provider: [" + xtype + "] 已经注册过了");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
return function (xtype, config) {
return BI.Providers.getProvider(xtype, config);
}
}; };
var configFunctions = {}; var configFunctions = {};
@ -294,7 +309,7 @@
_global.console && console.error("constant: [" + type + "] 未定义"); _global.console && console.error("constant: [" + type + "] 未定义");
} }
runConfigFunction(type); runConfigFunction(type);
return constantInjection[type]; return BI.isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type];
} }
}; };

Loading…
Cancel
Save