git 3 years ago
parent
commit
9f82d4574b
  1. 23
      examples/dev.html
  2. 3
      src/core/6.inject.js

23
examples/dev.html

@ -8,6 +8,29 @@
</head> </head>
<body> <body>
<div id="wrapper"></div> <div id="wrapper"></div>
<script>
BI.config("demo.parent", function (config){
console.log("123");
return config;
}, {
version: "1.0"
});
BI.module("my.module", {
components: {
"demo.parent": "1.0"
}
})
BI.config("bi.provider.system", function (provider) {
provider.addDependencies({
"my.module": {
min: "2.0",
max: "4.0"
}
})
})
</script>
<script> <script>
var Model = BI.inherit(Fix.Model, { var Model = BI.inherit(Fix.Model, {
state: function () { state: function () {

3
src/core/6.inject.js

@ -71,7 +71,8 @@
var configFunctions = {}; var configFunctions = {};
BI.config = BI.config || function (type, configFn, opt) { BI.config = BI.config || function (type, configFn, opt) {
opt = opt || {}; opt = opt || {};
if (BI.initialized) { // 初始化过或者系统配置需要立刻执行
if (BI.initialized || "bi.provider.system" === type) {
if (constantInjection[type]) { if (constantInjection[type]) {
return (constantInjection[type] = configFn(constantInjection[type])); return (constantInjection[type] = configFn(constantInjection[type]));
} }

Loading…
Cancel
Save