如何在本机对象的原型对象上捕获 getOwnPropertyDescriptor?

问题描述

我的目标对象是 Notification.prototype,我需要代理对它的 Object.getownPropertyDescriptor() 调用。我无法决定将我的代理分配到何处。

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 };
    }
});

我是否需要代理这个 Object.prototype.getownPropertyDescriptor 本身才能达到这种效果

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)