神岛 API 文档 - ArenaPro版
    Preparing search index...

    Interface ProxyConstructor

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

    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

    • Type Parameters

      • T extends object

      Parameters

      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 }

    • Type Parameters

      • T extends object

      Parameters

      Returns { proxy: T; revoke: () => void }