handler.deleteProperty()
The handler.deleteProperty()
method is a trap for the delete
operator.
Syntax
new Proxy(target, {
deleteProperty(target, property) {
}
});
Parameters
The following parameters are passed to the deleteProperty()
method.
this
is bound to the handler.
target
- : The target object.
property
- : The name or
Symbol
of the property to delete.
- : The name or
Return value
The deleteProperty()
method must return a Boolean
indicating
whether or not the property has been successfully deleted.
Description
The handler.deleteProperty()
method is a trap for the delete
operator.
Interceptions
This trap can intercept these operations:
- The
delete
operator:delete proxy[foo]
anddelete proxy.foo
Reflect.deleteProperty()
Or any other operation that invokes the [[Delete]]
internal method.
Invariants
If the following invariants are violated, the trap throws a TypeError
when invoked.
- A property cannot be deleted, if it exists as a non-configurable own property of the target object.