Interface ProxyConstructor

    interface ProxyConstructor {
        new ProxyConstructornew <T>(target: T, handler: ProxyHandler<T>): T;
        revocable<T>(target: T, handler: ProxyHandler<T>): {
            proxy: T;
            revoke: (() => void);
        };
    }

    Constructors

    Methods

    Constructors

    • 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.

      Type Parameters

      • T extends object

      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

    Methods

    • Creates a revocable Proxy object.

      Type Parameters

      • T extends object

      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);
      }

      • proxy: T
      • revoke: (() => void)
          • (): void
          • Returns void