Douglas Crockford 的 源代码
2011-07-03 12:53
288 查看
Function.method('inherits', function(parent) {
var depth = 0;
var proto = this.prototype = new parent();
this.method('uber', function uber(name) {
var func; var ret; var v = parent.prototype;
if (depth) {
for ( var i = d; i > 0; i += 1 ) {
v = v.constructor.prototype;
}
func = v[name];
}
else {
func = proto[name];
if ( func == this[name] ) {
func = v[name];
}
}
depth += 1;
ret = func.apply(this, Array.prototype.slice.apply(arguments, [1]));
depth -= 1;
return ret;
});
return this;
});
var depth = 0;
var proto = this.prototype = new parent();
this.method('uber', function uber(name) {
var func; var ret; var v = parent.prototype;
if (depth) {
for ( var i = d; i > 0; i += 1 ) {
v = v.constructor.prototype;
}
func = v[name];
}
else {
func = proto[name];
if ( func == this[name] ) {
func = v[name];
}
}
depth += 1;
ret = func.apply(this, Array.prototype.slice.apply(arguments, [1]));
depth -= 1;
return ret;
});
return this;
});
相关文章推荐
- Douglas Crockford
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford
- Douglas Crockford 确认参加第四届 D2 前端技术论坛
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford
- Douglas Crockford
- JavaScript大牛:Douglas Crockford
- Douglas Crockford: The JavaScript Programming Language
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford
- JavaScript: 世界上最被误解的语言|Douglas Crockford
- Douglas Crockford 大神写的 JavaScript 异步控制库:RQ(下)
- JavaScript: 世界上最被误解的语言|Douglas Crockford
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford
- Douglas Crockford 大神写的 JavaScript 异步控制库:RQ(上)
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford
- JavaScript大牛:Douglas Crockford