I know that the name of the method __defineGetter__(s __defineSetter__) is really strange and outdated , but I find it more convenient than Object.defineProperty. Compare yourself:
Something.prototype.__defineGetter__("name", function() {return this._name;});
Object.defineProperty(Something.prototype, "name", {
get: function() {return this._name;}
});
Because, as I said, this method is out of date. Therefore, I create a polyfill to return it to bussiness:
if(!Object.prototype.__defineGetter__) {
Object.prototype.__defineGetter__ = function(name, func) {
Object.defineProperty(this, name, {
get: func
});
}
}
It really just calls the standard one Object.defineProperty. I could call __defineGetter__what I wanted. I just decided to stick to what already existed.
The problem is that if I use __defineGetter__and __defineSetter__polyfills in one property, I called twice Object.defineProperty.
My question is: is it okay to call Object.definePropertytwice in the same property? Does it overwrite something for example?