|
|
@ -143,45 +143,49 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var callPoint = function (inst, type) { |
|
|
|
var callPoint = function (inst, types) { |
|
|
|
if (points[type]) { |
|
|
|
types = BI.isArray(types) ? types : [types]; |
|
|
|
for (var action in points[type]) { |
|
|
|
BI.each(types, function (idx, type) { |
|
|
|
var bfns = points[type][action].before; |
|
|
|
if (points[type]) { |
|
|
|
if (bfns) { |
|
|
|
for (var action in points[type]) { |
|
|
|
BI.aspect.before(inst, action, function (bfns) { |
|
|
|
var bfns = points[type][action].before; |
|
|
|
return function () { |
|
|
|
if (bfns) { |
|
|
|
for (var i = 0, len = bfns.length; i < len; i++) { |
|
|
|
BI.aspect.before(inst, action, function (bfns) { |
|
|
|
try { |
|
|
|
return function () { |
|
|
|
bfns[i].apply(inst, arguments); |
|
|
|
for (var i = 0, len = bfns.length; i < len; i++) { |
|
|
|
} catch (e) { |
|
|
|
try { |
|
|
|
_global.console && console.error(e); |
|
|
|
bfns[i].apply(inst, arguments); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
_global.console && console.error(e); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}(bfns)); |
|
|
|
}(bfns)); |
|
|
|
} |
|
|
|
} |
|
|
|
var afns = points[type][action].after; |
|
|
|
var afns = points[type][action].after; |
|
|
|
if (afns) { |
|
|
|
if (afns) { |
|
|
|
BI.aspect.after(inst, action, function (afns) { |
|
|
|
BI.aspect.after(inst, action, function (afns) { |
|
|
|
return function () { |
|
|
|
return function () { |
|
|
|
for (var i = 0, len = afns.length; i < len; i++) { |
|
|
|
for (var i = 0, len = afns.length; i < len; i++) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
afns[i].apply(inst, arguments); |
|
|
|
afns[i].apply(inst, arguments); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
_global.console && console.error(e); |
|
|
|
_global.console && console.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}(afns)); |
|
|
|
}(afns)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
BI.Models = { |
|
|
|
BI.Models = { |
|
|
|
getModel: function (type, config) { |
|
|
|
getModel: function (type, config) { |
|
|
|
var inst = new modelInjection[type](config); |
|
|
|
var inst = new modelInjection[type](config); |
|
|
|
inst._constructor && inst._constructor(config); |
|
|
|
inst._constructor && inst._constructor(config); |
|
|
|
|
|
|
|
inst.mixins && callPoint(inst, inst.mixins); |
|
|
|
callPoint(inst, type); |
|
|
|
callPoint(inst, type); |
|
|
|
return inst; |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|