|
|
@ -4217,15 +4217,45 @@ _.extend(BI.OB.prototype, { |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
BI.Constants = { |
|
|
|
var points = {}; |
|
|
|
getConstant: function (type) { |
|
|
|
BI.point = function (type, action, pointFn, after) { |
|
|
|
return constantInjection[type]; |
|
|
|
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 = { |
|
|
|
BI.Models = { |
|
|
|
getModel: function (type, config) { |
|
|
|
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]) { |
|
|
|
if (stores[type]) { |
|
|
|
return stores[type]; |
|
|
|
return stores[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
return stores[type] = new storeInjection[type](config); |
|
|
|
stores[type] = new storeInjection[type](config); |
|
|
|
}, |
|
|
|
callPoint(stores[type], type); |
|
|
|
releaseStore: function (type) { |
|
|
|
return stores[type]; |
|
|
|
delete stores[type]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -4250,10 +4279,9 @@ _.extend(BI.OB.prototype, { |
|
|
|
if (services[type]) { |
|
|
|
if (services[type]) { |
|
|
|
return services[type]; |
|
|
|
return services[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
return services[type] = new serviceInjection[type](config); |
|
|
|
services[type] = new serviceInjection[type](config); |
|
|
|
}, |
|
|
|
callPoint(services[type], type); |
|
|
|
releaseService: function (type) { |
|
|
|
return services[type]; |
|
|
|
delete services[type]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -4268,10 +4296,6 @@ _.extend(BI.OB.prototype, { |
|
|
|
providerInstance[type] = new providers[type].$get()(config); |
|
|
|
providerInstance[type] = new providers[type].$get()(config); |
|
|
|
} |
|
|
|
} |
|
|
|
return providerInstance[type]; |
|
|
|
return providerInstance[type]; |
|
|
|
}, |
|
|
|
|
|
|
|
releaseProvider: function (type) { |
|
|
|
|
|
|
|
delete providers[type]; |
|
|
|
|
|
|
|
delete providerInstance[type]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|