windy 7 years ago
parent
commit
bb00a20a9f
  1. 64
      dist/base.js
  2. 135
      dist/bundle.js
  3. 2
      dist/bundle.min.css
  4. 88
      dist/bundle.min.js
  5. 71
      dist/core.js
  6. 135
      dist/fineui.js
  7. 2
      dist/fineui.min.css
  8. 86
      dist/fineui.min.js
  9. 54
      src/base/combination/group.virtual.js
  10. 10
      src/base/pane.js
  11. 57
      src/core/inject.js
  12. 8
      src/core/ob.js
  13. 6
      src/core/widget.js
  14. 65
      utils/utils.js

64
dist/base.js vendored

@ -224,6 +224,16 @@ BI.Pane = BI.inherit(BI.Widget, {
_init: function () {
BI.Pane.superclass._init.apply(this, arguments);
if (this.__async) {
this.loading();
}
},
_render: function () {
BI.Pane.superclass._render.apply(this, arguments);
if (this.__async) {
this.loaded();
}
},
_assertTip: function () {
@ -3792,18 +3802,29 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
render: function () {
this.populate(this.options.items);
var o = this.options;
this.populate(o.items);
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
_packageBtns: function (items) {
var o = this.options;
var map = this.buttonMap = {};
for (var i = o.layouts.length - 1; i > 0; i--) {
items = BI.map(items, function (k, it) {
var el = BI.stripEL(it);
return BI.extend({}, o.layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
el: BI.stripEL(it)
el: BI.extend({
ref: function (_ref) {
if (BI.isKey(map[el.value])) {
map[el.value] = _ref;
}
}
}, el)
})
]
});
@ -3812,10 +3833,6 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
return items;
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
@ -3836,11 +3853,40 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
setValue: function (v) {
// this.layouts.setValue(v);
v = BI.isArray(v) ? v : [v];
BI.each(this.buttonMap, function (key, item) {
if (item) {
if (v.deepContains(key)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
}
});
},
getNotSelectedValue: function () {
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && !(item.isSelected && item.isSelected())) {
v.push(item.getValue());
}
}
});
return v;
},
getValue: function () {
return this.layouts.getValue();
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
}
});
return v;
},
populate: function (items) {

135
dist/bundle.js vendored

@ -12358,6 +12358,13 @@ _.extend(BI.OB.prototype, {
}
},
//释放当前对象
_purgeRef: function(){
if (this.options.ref) {
this.options.ref.call(null);
}
},
_getEvents: function () {
if (!$.isArray(this.events)) {
this.events = [];
@ -12453,6 +12460,7 @@ _.extend(BI.OB.prototype, {
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});/**
@ -12510,13 +12518,18 @@ BI.Widget = BI.inherit(BI.OB, {
this._initVisual();
this._initState();
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
},
_render: function () {
this.__asking = false;
this.beforeCreate && this.beforeCreate();
this._initElement();
this._initEffects();
@ -12916,6 +12929,7 @@ BI.Widget = BI.inherit(BI.OB, {
this.__d();
this.element.destroy();
this.fireEvent(BI.Events.DESTROY);
this._purgeRef();
this.purgeListeners();
}
});(function () {
@ -20327,15 +20341,52 @@ BI.extend(BI.DOM, {
};
};
var points = {};
BI.point = function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
BI.Constants = {
getConstant: function (type) {
return constantInjection[type];
}
};
var callPoint = function (inst, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function () {
for (var i = 0, len = bfns.length; i < len; i++) {
bfns[i].apply(inst, arguments);
}
});
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function () {
for (var i = 0, len = afns.length; i < len; i++) {
afns[i].apply(inst, arguments);
}
});
}
}
}
};
BI.Models = {
getModel: function (type, config) {
return new modelInjection[type](config);
var inst = new modelInjection[type](config);
callPoint(inst, type);
return inst;
}
};
@ -20346,10 +20397,9 @@ BI.extend(BI.DOM, {
if (stores[type]) {
return stores[type];
}
return stores[type] = new storeInjection[type](config);
},
releaseStore: function (type) {
delete stores[type];
stores[type] = new storeInjection[type](config);
callPoint(stores[type], type);
return stores[type];
}
};
@ -20360,10 +20410,9 @@ BI.extend(BI.DOM, {
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
@ -20378,10 +20427,6 @@ BI.extend(BI.DOM, {
providerInstance[type] = new providers[type].$get()(config);
}
return providerInstance[type];
},
releaseProvider: function (type) {
delete providers[type];
delete providerInstance[type];
}
};
@ -26218,6 +26263,16 @@ BI.Pane = BI.inherit(BI.Widget, {
_init: function () {
BI.Pane.superclass._init.apply(this, arguments);
if (this.__async) {
this.loading();
}
},
_render: function () {
BI.Pane.superclass._render.apply(this, arguments);
if (this.__async) {
this.loaded();
}
},
_assertTip: function () {
@ -29786,18 +29841,29 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
render: function () {
this.populate(this.options.items);
var o = this.options;
this.populate(o.items);
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
_packageBtns: function (items) {
var o = this.options;
var map = this.buttonMap = {};
for (var i = o.layouts.length - 1; i > 0; i--) {
items = BI.map(items, function (k, it) {
var el = BI.stripEL(it);
return BI.extend({}, o.layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
el: BI.stripEL(it)
el: BI.extend({
ref: function (_ref) {
if (BI.isKey(map[el.value])) {
map[el.value] = _ref;
}
}
}, el)
})
]
});
@ -29806,10 +29872,6 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
return items;
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
@ -29830,11 +29892,40 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
setValue: function (v) {
// this.layouts.setValue(v);
v = BI.isArray(v) ? v : [v];
BI.each(this.buttonMap, function (key, item) {
if (item) {
if (v.deepContains(key)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
}
});
},
getNotSelectedValue: function () {
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && !(item.isSelected && item.isSelected())) {
v.push(item.getValue());
}
}
});
return v;
},
getValue: function () {
return this.layouts.getValue();
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
}
});
return v;
},
populate: function (items) {

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

88
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

71
dist/core.js vendored

@ -12358,6 +12358,13 @@ _.extend(BI.OB.prototype, {
}
},
//释放当前对象
_purgeRef: function(){
if (this.options.ref) {
this.options.ref.call(null);
}
},
_getEvents: function () {
if (!$.isArray(this.events)) {
this.events = [];
@ -12453,6 +12460,7 @@ _.extend(BI.OB.prototype, {
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});/**
@ -12510,13 +12518,18 @@ BI.Widget = BI.inherit(BI.OB, {
this._initVisual();
this._initState();
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
},
_render: function () {
this.__asking = false;
this.beforeCreate && this.beforeCreate();
this._initElement();
this._initEffects();
@ -12916,6 +12929,7 @@ BI.Widget = BI.inherit(BI.OB, {
this.__d();
this.element.destroy();
this.fireEvent(BI.Events.DESTROY);
this._purgeRef();
this.purgeListeners();
}
});(function () {
@ -20327,15 +20341,52 @@ BI.extend(BI.DOM, {
};
};
var points = {};
BI.point = function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
BI.Constants = {
getConstant: function (type) {
return constantInjection[type];
}
};
var callPoint = function (inst, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function () {
for (var i = 0, len = bfns.length; i < len; i++) {
bfns[i].apply(inst, arguments);
}
});
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function () {
for (var i = 0, len = afns.length; i < len; i++) {
afns[i].apply(inst, arguments);
}
});
}
}
}
};
BI.Models = {
getModel: function (type, config) {
return new modelInjection[type](config);
var inst = new modelInjection[type](config);
callPoint(inst, type);
return inst;
}
};
@ -20346,10 +20397,9 @@ BI.extend(BI.DOM, {
if (stores[type]) {
return stores[type];
}
return stores[type] = new storeInjection[type](config);
},
releaseStore: function (type) {
delete stores[type];
stores[type] = new storeInjection[type](config);
callPoint(stores[type], type);
return stores[type];
}
};
@ -20360,10 +20410,9 @@ BI.extend(BI.DOM, {
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
@ -20378,10 +20427,6 @@ BI.extend(BI.DOM, {
providerInstance[type] = new providers[type].$get()(config);
}
return providerInstance[type];
},
releaseProvider: function (type) {
delete providers[type];
delete providerInstance[type];
}
};

135
dist/fineui.js vendored

@ -12559,6 +12559,13 @@ _.extend(BI.OB.prototype, {
}
},
//释放当前对象
_purgeRef: function(){
if (this.options.ref) {
this.options.ref.call(null);
}
},
_getEvents: function () {
if (!$.isArray(this.events)) {
this.events = [];
@ -12654,6 +12661,7 @@ _.extend(BI.OB.prototype, {
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});/**
@ -12711,13 +12719,18 @@ BI.Widget = BI.inherit(BI.OB, {
this._initVisual();
this._initState();
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
},
_render: function () {
this.__asking = false;
this.beforeCreate && this.beforeCreate();
this._initElement();
this._initEffects();
@ -13117,6 +13130,7 @@ BI.Widget = BI.inherit(BI.OB, {
this.__d();
this.element.destroy();
this.fireEvent(BI.Events.DESTROY);
this._purgeRef();
this.purgeListeners();
}
});(function () {
@ -20528,15 +20542,52 @@ BI.extend(BI.DOM, {
};
};
var points = {};
BI.point = function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
BI.Constants = {
getConstant: function (type) {
return constantInjection[type];
}
};
var callPoint = function (inst, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function () {
for (var i = 0, len = bfns.length; i < len; i++) {
bfns[i].apply(inst, arguments);
}
});
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function () {
for (var i = 0, len = afns.length; i < len; i++) {
afns[i].apply(inst, arguments);
}
});
}
}
}
};
BI.Models = {
getModel: function (type, config) {
return new modelInjection[type](config);
var inst = new modelInjection[type](config);
callPoint(inst, type);
return inst;
}
};
@ -20547,10 +20598,9 @@ BI.extend(BI.DOM, {
if (stores[type]) {
return stores[type];
}
return stores[type] = new storeInjection[type](config);
},
releaseStore: function (type) {
delete stores[type];
stores[type] = new storeInjection[type](config);
callPoint(stores[type], type);
return stores[type];
}
};
@ -20561,10 +20611,9 @@ BI.extend(BI.DOM, {
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
@ -20579,10 +20628,6 @@ BI.extend(BI.DOM, {
providerInstance[type] = new providers[type].$get()(config);
}
return providerInstance[type];
},
releaseProvider: function (type) {
delete providers[type];
delete providerInstance[type];
}
};
@ -27972,6 +28017,16 @@ BI.Pane = BI.inherit(BI.Widget, {
_init: function () {
BI.Pane.superclass._init.apply(this, arguments);
if (this.__async) {
this.loading();
}
},
_render: function () {
BI.Pane.superclass._render.apply(this, arguments);
if (this.__async) {
this.loaded();
}
},
_assertTip: function () {
@ -31540,18 +31595,29 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
render: function () {
this.populate(this.options.items);
var o = this.options;
this.populate(o.items);
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
_packageBtns: function (items) {
var o = this.options;
var map = this.buttonMap = {};
for (var i = o.layouts.length - 1; i > 0; i--) {
items = BI.map(items, function (k, it) {
var el = BI.stripEL(it);
return BI.extend({}, o.layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
el: BI.stripEL(it)
el: BI.extend({
ref: function (_ref) {
if (BI.isKey(map[el.value])) {
map[el.value] = _ref;
}
}
}, el)
})
]
});
@ -31560,10 +31626,6 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
return items;
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
@ -31584,11 +31646,40 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
},
setValue: function (v) {
// this.layouts.setValue(v);
v = BI.isArray(v) ? v : [v];
BI.each(this.buttonMap, function (key, item) {
if (item) {
if (v.deepContains(key)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
}
});
},
getNotSelectedValue: function () {
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && !(item.isSelected && item.isSelected())) {
v.push(item.getValue());
}
}
});
return v;
},
getValue: function () {
return this.layouts.getValue();
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
}
});
return v;
},
populate: function (items) {

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

86
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

54
src/base/combination/group.virtual.js

@ -12,18 +12,29 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
},
render: function () {
this.populate(this.options.items);
var o = this.options;
this.populate(o.items);
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
_packageBtns: function (items) {
var o = this.options;
var map = this.buttonMap = {};
for (var i = o.layouts.length - 1; i > 0; i--) {
items = BI.map(items, function (k, it) {
var el = BI.stripEL(it);
return BI.extend({}, o.layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
el: BI.stripEL(it)
el: BI.extend({
ref: function (_ref) {
if (BI.isKey(map[el.value])) {
map[el.value] = _ref;
}
}
}, el)
})
]
});
@ -32,10 +43,6 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
return items;
},
_packageItems: function (items, packBtns) {
return BI.createItems(BI.makeArrayByArray(items, {}), BI.clone(packBtns));
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
@ -56,11 +63,40 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
},
setValue: function (v) {
// this.layouts.setValue(v);
v = BI.isArray(v) ? v : [v];
BI.each(this.buttonMap, function (key, item) {
if (item) {
if (v.deepContains(key)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
}
});
},
getNotSelectedValue: function () {
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && !(item.isSelected && item.isSelected())) {
v.push(item.getValue());
}
}
});
return v;
},
getValue: function () {
return this.layouts.getValue();
var v = [];
BI.each(this.buttonMap, function (i, item) {
if (item) {
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
}
});
return v;
},
populate: function (items) {

10
src/base/pane.js

@ -19,6 +19,16 @@ BI.Pane = BI.inherit(BI.Widget, {
_init: function () {
BI.Pane.superclass._init.apply(this, arguments);
if (this.__async) {
this.loading();
}
},
_render: function () {
BI.Pane.superclass._render.apply(this, arguments);
if (this.__async) {
this.loaded();
}
},
_assertTip: function () {

57
src/core/inject.js

@ -66,15 +66,52 @@
};
};
var points = {};
BI.point = function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
BI.Constants = {
getConstant: function (type) {
return constantInjection[type];
}
};
var callPoint = function (inst, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function () {
for (var i = 0, len = bfns.length; i < len; i++) {
bfns[i].apply(inst, arguments);
}
});
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function () {
for (var i = 0, len = afns.length; i < len; i++) {
afns[i].apply(inst, arguments);
}
});
}
}
}
};
BI.Models = {
getModel: function (type, config) {
return new modelInjection[type](config);
var inst = new modelInjection[type](config);
callPoint(inst, type);
return inst;
}
};
@ -85,10 +122,9 @@
if (stores[type]) {
return stores[type];
}
return stores[type] = new storeInjection[type](config);
},
releaseStore: function (type) {
delete stores[type];
stores[type] = new storeInjection[type](config);
callPoint(stores[type], type);
return stores[type];
}
};
@ -99,10 +135,9 @@
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
@ -117,10 +152,6 @@
providerInstance[type] = new providers[type].$get()(config);
}
return providerInstance[type];
},
releaseProvider: function (type) {
delete providers[type];
delete providerInstance[type];
}
};

8
src/core/ob.js

@ -44,6 +44,13 @@ _.extend(BI.OB.prototype, {
}
},
//释放当前对象
_purgeRef: function(){
if (this.options.ref) {
this.options.ref.call(null);
}
},
_getEvents: function () {
if (!$.isArray(this.events)) {
this.events = [];
@ -139,6 +146,7 @@ _.extend(BI.OB.prototype, {
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});

6
src/core/widget.js

@ -53,13 +53,18 @@ BI.Widget = BI.inherit(BI.OB, {
this._initVisual();
this._initState();
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
},
_render: function () {
this.__asking = false;
this.beforeCreate && this.beforeCreate();
this._initElement();
this._initEffects();
@ -459,6 +464,7 @@ BI.Widget = BI.inherit(BI.OB, {
this.__d();
this.element.destroy();
this.fireEvent(BI.Events.DESTROY);
this._purgeRef();
this.purgeListeners();
}
});

65
utils/utils.js

@ -3365,6 +3365,13 @@ _.extend(BI.OB.prototype, {
}
},
//释放当前对象
_purgeRef: function(){
if (this.options.ref) {
this.options.ref.call(null);
}
},
_getEvents: function () {
if (!$.isArray(this.events)) {
this.events = [];
@ -3460,6 +3467,7 @@ _.extend(BI.OB.prototype, {
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});(function () {
@ -4217,15 +4225,52 @@ _.extend(BI.OB.prototype, {
};
};
var points = {};
BI.point = function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
BI.Constants = {
getConstant: function (type) {
return constantInjection[type];
}
};
var callPoint = function (inst, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function () {
for (var i = 0, len = bfns.length; i < len; i++) {
bfns[i].apply(inst, arguments);
}
});
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function () {
for (var i = 0, len = afns.length; i < len; i++) {
afns[i].apply(inst, arguments);
}
});
}
}
}
};
BI.Models = {
getModel: function (type, config) {
return new modelInjection[type](config);
var inst = new modelInjection[type](config);
callPoint(inst, type);
return inst;
}
};
@ -4236,10 +4281,9 @@ _.extend(BI.OB.prototype, {
if (stores[type]) {
return stores[type];
}
return stores[type] = new storeInjection[type](config);
},
releaseStore: function (type) {
delete stores[type];
stores[type] = new storeInjection[type](config);
callPoint(stores[type], type);
return stores[type];
}
};
@ -4250,10 +4294,9 @@ _.extend(BI.OB.prototype, {
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
@ -4268,10 +4311,6 @@ _.extend(BI.OB.prototype, {
providerInstance[type] = new providers[type].$get()(config);
}
return providerInstance[type];
},
releaseProvider: function (type) {
delete providers[type];
delete providerInstance[type];
}
};

Loading…
Cancel
Save