sys.inherts to shadow constructor property from enumerability
thanks to ES5 features in V8 it is quite easily possible.
This commit is contained in:
parent
6b430a95c9
commit
d3f04933f1
10
lib/sys.js
10
lib/sys.js
@ -315,9 +315,11 @@ exports.pump = function (readStream, writeStream, callback) {
|
|||||||
* @param {function} superCtor Constructor function to inherit prototype from
|
* @param {function} superCtor Constructor function to inherit prototype from
|
||||||
*/
|
*/
|
||||||
exports.inherits = function (ctor, superCtor) {
|
exports.inherits = function (ctor, superCtor) {
|
||||||
var tempCtor = function(){};
|
|
||||||
tempCtor.prototype = superCtor.prototype;
|
|
||||||
ctor.super_ = superCtor;
|
ctor.super_ = superCtor;
|
||||||
ctor.prototype = new tempCtor();
|
ctor.prototype = Object.create(superCtor.prototype, {
|
||||||
ctor.prototype.constructor = ctor;
|
constructor: {
|
||||||
|
value: ctor,
|
||||||
|
enumerable: false
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user