handler.preventExtensions()
The handler.preventExtensions()
method is a trap for Object.preventExtensions()
.
Syntax
new Proxy(target, {
preventExtensions(target) {
}
});
Parameters
The following parameter is passed to the preventExtensions()
method. this
is bound to the handler.
target
- : The target object.
Return value
The preventExtensions()
method must return a boolean value.
Description
The handler.preventExtensions()
method is a trap for Object.preventExtensions()
.
Interceptions
This trap can intercept these operations:
Or any other operation that invokes the [[PreventExtensions]]
internal method.
Invariants
If the following invariants are violated, the trap throws a TypeError
when invoked.
Object.preventExtensions(proxy)
only returnstrue
ifObject.isExtensible(proxy)
isfalse
.