Proxy.handler
Proxy.handler
处理器对象用来自定义代理对象的各种可代理操作。
方法
一共有 13 种可代理操作,每种操作的代号(属性名/方法名)和触发这种操作的方式列举如下。注意,如果没有定义某种操作,那么这种操作会被转发到目标对象身上。
handler.getPrototypeOf()
在读取代理对象的原型时触发该操作,比如在执行 Object.getPrototypeOf(proxy)
时。
一些非标准的陷阱已经过时,已被删除。
规范
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'Proxy Object Internal Methods and Internal Slots' in that specification. | Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262)The definition of 'Proxy Object Internal Methods and Internal Slots' in that specification. | Living Standard | The enumerate handler has been removed. |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 49 1 | 18 (18) | 12 | 36 | 10 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | No support | No support | 18 (18) | No support | No support | No support |