Browse Source

优化代码

es6
guy 3 years ago
parent
commit
f91c1c0cfa
  1. 19
      src/core/6.inject.js

19
src/core/6.inject.js

@ -31,6 +31,9 @@
} }
} }
moduleInjection[xtype] = cls; moduleInjection[xtype] = cls;
return function () {
return BI.Modules.getModule(xtype);
};
}; };
var constantInjection = {}; var constantInjection = {};
@ -41,7 +44,7 @@
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
return function () { return function () {
return BI.Constants.getConstant(xtype); return BI.Constants.getConstant(xtype);
} };
}; };
var modelInjection = {}; var modelInjection = {};
@ -50,7 +53,7 @@
_global.console && console.error("model: [" + xtype + "] 已经注册过了"); _global.console && console.error("model: [" + xtype + "] 已经注册过了");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
return function (xtype, config) { return function (config) {
return BI.Models.getModel(xtype, config); return BI.Models.getModel(xtype, config);
}; };
}; };
@ -61,9 +64,9 @@
_global.console && console.error("store: [" + xtype + "] 已经注册过了"); _global.console && console.error("store: [" + xtype + "] 已经注册过了");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
return function (xtype, config) { return function (config) {
return BI.Stores.getStore(xtype, config); return BI.Stores.getStore(xtype, config);
} };
}; };
var serviceInjection = {}; var serviceInjection = {};
@ -72,9 +75,9 @@
_global.console && console.error("service: [" + xtype + "] 已经注册过了"); _global.console && console.error("service: [" + xtype + "] 已经注册过了");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
return function (xtype, config) { return function (config) {
return BI.Services.getService(xtype, config); return BI.Services.getService(xtype, config);
} };
}; };
var providerInjection = {}; var providerInjection = {};
@ -83,9 +86,9 @@
_global.console && console.error("provider: [" + xtype + "] 已经注册过了"); _global.console && console.error("provider: [" + xtype + "] 已经注册过了");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
return function (xtype, config) { return function (config) {
return BI.Providers.getProvider(xtype, config); return BI.Providers.getProvider(xtype, config);
} };
}; };
var configFunctions = {}; var configFunctions = {};

Loading…
Cancel
Save