Interface ProxyHandler<T>
interface ProxyHandler<T extends object> {
apply(target: T, thisArg: any, argArray: any[]): any;
construct(target: T, argArray: any[], newTarget: Function): object;
defineProperty(
target: T,
property: string | symbol,
attributes: PropertyDescriptor,
): boolean;
deleteProperty(target: T, p: string | symbol): boolean;
get(target: T, p: string | symbol, receiver: any): any;
getOwnPropertyDescriptor(target: T, p: string | symbol): PropertyDescriptor;
getPrototypeOf(target: T): object;
has(target: T, p: string | symbol): boolean;
isExtensible(target: T): boolean;
ownKeys(target: T): ArrayLike<string | symbol>;
preventExtensions(target: T): boolean;
set(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
setPrototypeOf(target: T, v: object): boolean;
}
apply(target: T, thisArg: any, argArray: any[]): any;
construct(target: T, argArray: any[], newTarget: Function): object;
defineProperty(
target: T,
property: string | symbol,
attributes: PropertyDescriptor,
): boolean;
deleteProperty(target: T, p: string | symbol): boolean;
get(target: T, p: string | symbol, receiver: any): any;
getOwnPropertyDescriptor(target: T, p: string | symbol): PropertyDescriptor;
getPrototypeOf(target: T): object;
has(target: T, p: string | symbol): boolean;
isExtensible(target: T): boolean;
ownKeys(target: T): ArrayLike<string | symbol>;
preventExtensions(target: T): boolean;
set(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
setPrototypeOf(target: T, v: object): boolean;
}
Type Parameters
Methods
Optional
apply
Optional
construct
Optional
defineProperty
- defineProperty(
target: T,
property: string | symbol,
attributes: PropertyDescriptor,
): boolean A trap for
Object.defineProperty()
.Parameters
- target: T
The original object which is being proxied.
- property: string | symbol
- attributes: PropertyDescriptor
Returns boolean
A
Boolean
indicating whether or not the property has been defined.- target: T
Optional
deleteProperty
Optional
get
Optional
getOwnPropertyDescriptor
- getOwnPropertyDescriptor(target: T, p: string | symbol): PropertyDescriptor
A trap for
Object.getOwnPropertyDescriptor()
.Parameters
- target: T
The original object which is being proxied.
- p: string | symbol
The name of the property whose description should be retrieved.
Returns PropertyDescriptor
- target: T
Optional
getPrototypeOf
Optional
has
Optional
isExtensible
Optional
ownKeys
Optional
preventExtensions
Optional
set
- set(target: T, p: string | symbol, newValue: any, receiver: any): boolean
A trap for setting a property value.
Parameters
- target: T
The original object which is being proxied.
- p: string | symbol
The name or
Symbol
of the property to set. - newValue: any
- receiver: any
The object to which the assignment was originally directed.
Returns boolean
A
Boolean
indicating whether or not the property was set.- target: T
A trap method for a function call.