|
|
|
@ -4217,15 +4217,45 @@ _.extend(BI.OB.prototype, {
|
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.Constants = { |
|
|
|
|
getConstant: function (type) { |
|
|
|
|
return constantInjection[type]; |
|
|
|
|
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); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var callPoint = function (inst, type) { |
|
|
|
|
if (points[type]) { |
|
|
|
|
for (var action in points[type]) { |
|
|
|
|
var fns = points[type][action].before; |
|
|
|
|
if (fns) { |
|
|
|
|
BI.aspect.before(inst, action, function () { |
|
|
|
|
for (var i = 0, len = fns.length; i < len; i++) { |
|
|
|
|
fns[i].apply(inst, arguments); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
fns = points[type][action].after; |
|
|
|
|
if (fns) { |
|
|
|
|
BI.aspect.after(inst, action, function () { |
|
|
|
|
for (var i = 0, len = fns.length; i < len; i++) { |
|
|
|
|
fns[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 +4266,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 +4279,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 +4296,6 @@ _.extend(BI.OB.prototype, {
|
|
|
|
|
providerInstance[type] = new providers[type].$get()(config); |
|
|
|
|
} |
|
|
|
|
return providerInstance[type]; |
|
|
|
|
}, |
|
|
|
|
releaseProvider: function (type) { |
|
|
|
|
delete providers[type]; |
|
|
|
|
delete providerInstance[type]; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|