The proxy's handler object is a placeholder object which contains traps for proxies.
All traps are optional. If a trap has not been defined, the default behavior is to forward the operation to the target.
handler.getPrototypeOf()
Object.getPrototypeOf
.handler.setPrototypeOf()
Object.setPrototypeOf
.handler.isExtensible()
Object.isExtensible
.handler.preventExtensions()
Object.preventExtensions
.handler.getOwnPropertyDescriptor()
Object.getOwnPropertyDescriptor
.handler.defineProperty()
Object.defineProperty
.handler.has()
in
operator.handler.get()
handler.set()
handler.deleteProperty()
delete
operator.handler.ownKeys()
Object.getOwnPropertyNames
and Object.getOwnPropertySymbols
.handler.apply()
handler.construct()
new
operator.Some non-standard traps are obsolete and have been removed.
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 | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
apply |
49 | 12 | 18 | No | 36 | 10 |
construct |
49 | 12 | 18 | No | 36 | 10 |
defineProperty |
49 | 12 | 18 | No | 36 | 10 |
deleteProperty |
49 | 12 | 18 | No | 36 | 10 |
enumerate |
No | No | 37 — 47 | No | No | No |
get |
49 | 12 | 18 | No | 36 | 10 |
getOwnPropertyDescriptor |
49 | 12 | 18 | No | 36 | 10 |
getPrototypeOf |
No | No | 49 | No | No | No |
has |
49 | 12 | 18 | No | 36 | 10 |
isExtensible |
? | ? | 31 | No | ? | ? |
ownKeys |
49 | 12 | 181 | No | 36 | 10 |
preventExtensions |
49 | 12 | 22 | No | 36 | 10 |
set |
49 | 12 | 18 | No | 36 | 10 |
setPrototypeOf |
? | ? | 49 | No | ? | ? |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
apply |
49 | 49 | Yes | 18 | No | 36 | 10 |
construct |
49 | 49 | Yes | 18 | No | 36 | 10 |
defineProperty |
49 | 49 | Yes | 18 | No | 36 | 10 |
deleteProperty |
49 | 49 | Yes | 18 | No | 36 | 10 |
enumerate |
No | No | No | 37 — 47 | No | No | No |
get |
49 | 49 | Yes | 18 | No | 36 | 10 |
getOwnPropertyDescriptor |
49 | 49 | Yes | 18 | No | 36 | 10 |
getPrototypeOf |
No | No | No | 49 | No | No | No |
has |
49 | 49 | Yes | 18 | No | 36 | 10 |
isExtensible |
? | ? | ? | 31 | No | ? | ? |
ownKeys |
49 | 49 | Yes | 181 | No | 36 | 10 |
preventExtensions |
49 | 49 | Yes | 22 | No | 36 | 10 |
set |
49 | 49 | Yes | 18 | No | 36 | 10 |
setPrototypeOf |
? | ? | ? | 49 | No | ? | ? |
1. In Firefox 42, the implementation got updated to reflect the final ES2015 specification: The result is now checked if it is an array and if the array elements are either of type string or of type symbol. Enumerating duplicate own property names is not a failure anymore.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler