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 compatibility

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.

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