My target object is Notification.prototype
and I need to proxy the Object.getOwnPropertyDescriptor()
calls to it. I'm unable decide where to assign my proxy into.
var myProxy = new Proxy(obj, {
get: function(target, key) {
console.log("GET CALLED");
return target[key];
},
ownKeys: function() {
console.log("Own Keys called");
return ["a", "b"];
},
getOwnPropertyDescriptor: function(target, key) {
console.log("Property Descriptor Called");
return { value: this.get(target, key), enumerable: true, configurable: true };
}
});
Do I need to proxy this Object.prototype.getOwnPropertyDescriptor
itself to achieve this effect?