¦ProxyÆECMA5ªÀ³êÄ��énÅ®©µÄËB
ÇL:prototype`F[Ésuperª2ÂÞÆ[v·é�}ÆÉCªÂ��½EEE̾¯ÇAð@ªí©çñBsuperÍêñ¾¯Å�Nè��µÜ·(�}êÍÐÇ��)B
ÜA\[XR[hÍ�}꾯ÈñÅ·ªBµ©µÈªçAvpeB¾ÆsuperÁÄ��Äàê½CÈñÅ·ËEEEB
Object.defineProperty(Object.prototype, 'super', {
get: function() {
var superProto, method, constructor;
superProto = Object.getPrototypeOf(Object.getPrototypeOf(this));
method = function(rcvr, name) {
return superProto[name].bind(this);
}.bind(this);
constructor = function() {
superProto.constructor.apply(this, arguments);
}.bind(this);
return Proxy.createFunction({get: method}, constructor);
}
});
�}ñÈ�L��Åg¦Ü·Bextend·énÌCuÅàÊÉ®Æv��ܷB
function A(message) {
this.message = message;
}
function B() {
//super classÌRXgN^ðÄÔ
this.super('hello!');
}
B.prototype = Object.create(A.prototype);
A.prototype.foo = function() {
return '#' + this.message + '#';
};
B.prototype.foo = function() {
//super classÌ\bhðÄÔ
//à¿ëñcall(this)µÈÄàOK
return '(' + this.super.foo() + ')';
};
var b = new B;
b.foo(); // '(#hello!#);'ªÔÁÄéB