”;
The JavaScript Proxy Handlers are used to define custom behavior for fundamental operations performed on objects. By defining handlers, you can override the default behavior of fundamental operations. Following are the common proxy handler methods: apply(), construct(), get(), has(), etc.
JavaScript Handlers
Following are the methods of JavaScript Handler −
Sr.No. | Name & Description |
---|---|
1 | apply()
Allows you call a function with particular arguments and context.
|
2 | construct()
Allows you to define custom behavior for fundamental operations on an object.
|
3 | defineproperty()
It is used to define new properties or modify existing ones on an object.
|
4 | deleteproperty()
It is used as a trap for the delete operator.
|
5 | get()
It is a trap for getting a property value.
|
6 | getownpropertydescriptor()
It is a trap for the [[GetOwnProperty]] object internal method.
|
7 | getprototypeof()
It is a trap for the internal method.
|
8 | has()
It is used to “hide” any property that you want.
|
9 | isextensible()
It is used to determine whether the new property can be added or not the target object.
|
10 | ownkeys()
It is a trap for the [[OwnPropertyKeys]] object internal method.
|
11 | set()
It is a trap for the [[Set]] object internal method.
|
12 | setprototypeof()
Allows you set the prototype of a specified object to another object to another object.
|
”;