Questa traduzione è incompleta. Collabora alla traduzione di questo articolo dall’originale in lingua inglese.

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.
Draft 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 AndroidOpera AndroidiOS SafariSamsung Internet
apply4949 Yes1836105.0
construct4949 Yes1836105.0
defineProperty4949 Yes1836105.0
deleteProperty4949 Yes1836105.0
enumerate No No No37 — 47 No No No
get4949 Yes1836105.0
getOwnPropertyDescriptor4949 Yes1836105.0
getPrototypeOf No No No49 No No No
has4949 Yes1836105.0
isExtensible ? ? ?31 ? ? ?
ownKeys4949 Yes18136105.0
preventExtensions4949 Yes2236105.0
set4949 Yes1836105.0
setPrototypeOf ? ? ?49 ? ? ?

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

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: fscholz
Ultima modifica di: fscholz,