W3cubDocs

/JavaScript

Proxy.handler

The proxy's handler object is a placeholder object which contains traps for proxies.

Methods

All traps are optional. If a trap has not been defined, the default behavior is to forward the operation to the target.

handler.getPrototypeOf()
A trap for Object.getPrototypeOf.
handler.setPrototypeOf()
A trap for Object.setPrototypeOf.
handler.isExtensible()
A trap for Object.isExtensible.
handler.preventExtensions()
A trap for Object.preventExtensions.
handler.getOwnPropertyDescriptor()
A trap for Object.getOwnPropertyDescriptor.
handler.defineProperty()
A trap for Object.defineProperty.
handler.has()
A trap for the in operator.
handler.get()
A trap for getting property values.
handler.set()
A trap for setting property values.
handler.deleteProperty()
A trap for the delete operator.
handler.ownKeys()
A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
handler.apply()
A trap for a function call.
handler.construct()
A trap for the new operator.

Some non-standard traps are obsolete and have been removed.

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
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 18
18
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.
No 36 10
preventExtensions 49 12 22 No 36 10
set 49 12 18 No 36 10
setPrototypeOf ? ? 49 No ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
apply 49 49 Yes 18 36 10 5.0
construct 49 49 Yes 18 36 10 5.0
defineProperty 49 49 Yes 18 36 10 5.0
deleteProperty 49 49 Yes 18 36 10 5.0
enumerate No No No 37 — 47 No No No
get 49 49 Yes 18 36 10 5.0
getOwnPropertyDescriptor 49 49 Yes 18 36 10 5.0
getPrototypeOf No No No 49 No No No
has 49 49 Yes 18 36 10 5.0
isExtensible ? ? ? 31 ? ? ?
ownKeys 49 49 Yes 18
18
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.
36 10 5.0
preventExtensions 49 49 Yes 22 36 10 5.0
set 49 49 Yes 18 36 10 5.0
setPrototypeOf ? ? ? 49 ? ? ?
Server
Node.js
apply 6.0.0
construct 6.0.0
defineProperty 6.0.0
deleteProperty 6.0.0
enumerate No
get 6.0.0
getOwnPropertyDescriptor 6.0.0
getPrototypeOf 6.0.0
has 6.0.0
isExtensible 6.0.0
ownKeys 6.0.0
preventExtensions 6.0.0
set 6.0.0
setPrototypeOf 6.0.0

See also

© 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