/**
* Copies all the properties of config to obj.
* @param {Object} 继承的对象
* @param {Object} 新的配置参数--这个值可以为空
* @param {Object} 新的配置参数--这个值可以为空
* @return {Object} returns obj 返回复制值后的对象
* @member Ext apply
*/
Ext.apply = function(o, c, defaults){
// no "this" reference for friendly out of scope calls
if(defaults){
Ext.apply(o, defaults);
}
if(o && c && typeof c == 'object'){
for(var p in c){
o[p] = c[p];
}
}
return o;
};
//执行过程是:将c的值和defaults的值拷贝给o,然后返回o对象
//使用方式:
var o = {};
var c = {name:'tom',showName:function(){alert(name);}};
var d = {age:23};
Ext.apply(o,c,d);
extjs源码分析-001(Ext.apply)
最新推荐文章于 2014-12-17 14:01:00 发布