Interface ProxyConstructor
interface ProxyConstructor {
new ProxyConstructor<T extends object>(
target: T,
handler: ProxyHandler<T>,
): T;
revocable<T extends object>(
target: T,
handler: ProxyHandler<T>,
): { proxy: T; revoke: () => void };
}
new ProxyConstructor<T extends object>(
target: T,
handler: ProxyHandler<T>,
): T;
revocable<T extends object>(
target: T,
handler: ProxyHandler<T>,
): { proxy: T; revoke: () => void };
}
Index
Constructors
Methods
Constructors
constructor
- new ProxyConstructor<T extends object>(target: T, handler: ProxyHandler<T>): T
Type Parameters
Parameters
- target: T
A target object to wrap with Proxy.
- handler: ProxyHandler<T>
An object whose properties define the behavior of Proxy when an operation is attempted on it.
Returns T
- target: T
Methods
revocable
- revocable<T extends object>(
target: T,
handler: ProxyHandler<T>,
): { proxy: T; revoke: () => void } Creates a revocable Proxy object.
Type Parameters
Parameters
- target: T
A target object to wrap with Proxy.
- handler: ProxyHandler<T>
An object whose properties define the behavior of Proxy when an operation is attempted on it.
Returns { proxy: T; revoke: () => void }
- target: T
Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.