How is SAP UI5 Aggregation designed

我的sample code: 最后是framework debug

<html>
<script>

function Aggregation(name) {
this.mAggregationName = name;
}

var oItemAgg = new Aggregation("item"); // so far, Aggregation oject has no available method

debugger;

Aggregation.prototype.generate = function(add, prototype) {
var that = this, n = that.mAggregationName;

add("getAggregation", prototype, function() {
console.log(" getAggregation should be implemented here!");
});
}

function add(name, proto, fn){
if ( !proto[name] ) {
proto[name] =  fn;
}
}

oItemAgg.generate(add, Aggregation.prototype);

oItemAgg.getAggregation();

debugger;
</script>
How is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designedHow is SAP UI5 Aggregation designed

这里的bindItem实际上不是一个function,而是Javascript对象的一个attribute,该attribute指向了一个匿名函数,其实现是 this.bindAggregation(n, o, t, s,f)

How is SAP UI5 Aggregation designed

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
How is SAP UI5 Aggregation designed

上一篇:SAP UI5不支持delta render


下一篇:UI5-学习篇-8-本地SAP WEB IDE开发