• Subscribe to a graph node whose value is bulk numeric data, receiving a typed-array view.

    Type Parameters

    Parameters

    • node: Node<unknown>

      The input or derived node to subscribe to. The component re-renders only when this node's value changes — unrelated commits do not trigger a re-render (same per-node-subscription semantics as useCauslNode).

    • ctor: CauslTypedArrayCtor<T>

      Constructor for the typed array shape to return. Used by the JS-engine fallback to coerce non-T committed values (e.g. a plain number[]) into a T view; ignored on the WASM path where the engine reports the element shape directly.

    Returns T

    A typed-array view of the node's current committed value. The reference is stable across renders until the next commit during which the engine reports a value change — same-commit reads return the identically-Object.is-equal view.

    Error when called outside <CauslProvider>.

    Zero-copy path (WASM backend, deferred — #680 / #682 / #683 / #693). When the WASM backend is active, the returned view points directly into the engine's linear memory: new ctor(memory.buffer, offset, length). No copy occurs per render. The engine guarantees no memory.grow() between the getSnapshot read and the React render that consumes the view; grows happen only at commit boundaries.

    Fallback path (JS engine, today). The hook reads the node's current value via graph.read(node). If the value is already an instance of ctor, it is returned verbatim. Otherwise the hook coerces it via ctor.from(value) (one-shot copy on commit). A cached view reference is reused across renders for the same commit, so React.memo consumers comparing by identity skip work.

    Stability contract. The view returned for commit N is Object.is-equal to itself across every render between commit N and commit N+1. After a commit that changes the subscribed node, the hook returns a fresh view (new reference). Adopters MAY rely on Object.is(viewA, viewB) === false as a signal that the underlying numeric data changed.

    Subscribe to a Float64Array cell range:

    const range = useCauslTypedArrayNode(prices, Float64Array)
    // `range` is stable across renders until `prices` next changes.

    Subscribe to a Uint8Array blob in a hex viewer:

    const bytes = useCauslTypedArrayNode(blob, Uint8Array)
    

    useCauslNode — single-node subscription without typed-array coercion.