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

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.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
apply491218 No3610
construct491218 No3610
defineProperty491218 No3610
deleteProperty491218 No3610
enumerate No No37 — 47 No No No
get491218 No3610
getOwnPropertyDescriptor491218 No3610
getPrototypeOf No No49 No No No
has491218 No3610
isExtensible ? ?31 No ? ?
ownKeys4912181 No3610
preventExtensions491222 No3610
set491218 No3610
setPrototypeOf ? ?49 No ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
apply4949 Yes18 No3610
construct4949 Yes18 No3610
defineProperty4949 Yes18 No3610
deleteProperty4949 Yes18 No3610
enumerate No No No37 — 47 No No No
get4949 Yes18 No3610
getOwnPropertyDescriptor4949 Yes18 No3610
getPrototypeOf No No No49 No No No
has4949 Yes18 No3610
isExtensible ? ? ?31 No ? ?
ownKeys4949 Yes181 No3610
preventExtensions4949 Yes22 No3610
set4949 Yes18 No3610
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

Document Tags and Contributors

 Contributors to this page: fscholz, SphinxKnight, fasttime, kdex, jwhitlock, DanielHerr, pnevyk, ziyunfei, arai
 Last updated by: fscholz,