footprintjs - v11.2.0
    Preparing search index...

    Function createArrayProxy

    • Creates a Proxy over an array that intercepts mutating operations.

      The actual current array is the Proxy target: Node.js console.log inspects the target directly (bypasses Proxy traps), so the real array shows correct values. The target reference is fixed at creation time — after mutations, the proxy returns a new proxy (via cache invalidation) with the fresh array as target.

      READS are live while the key holds an array and answer from the array the handle was made over once it does not; WRITES are refused then, with a TypeError that names the key (see liveArray).

      Type Parameters

      • T

      Parameters

      • getCurrent: () => T[]

        Returns the current array snapshot from state

      • commit: (newArray: T[]) => void

        Called with the new array after a mutation (triggers setValue)

      • name: string = ''

        The value's name in state, used in error messages

      • Optionalcaptured: T[]

        The array the handle is made over, when the caller already holds it (a member read off a captured object whose path is gone). Default: what getCurrent returns now.

      Returns T[]

      Proxied array with copy-on-write semantics