stax-monorepo
    Preparing search index...

    Type Alias SignalArray

    SignalArray namespace.

    type SignalArray = {
        make: <T>(
            initial?: readonly T[],
        ) => Effect<SignalArray<T>, never, Scope>;
        OutOfBoundsError: typeof OutOfBoundsError;
        trace: (
            id: string,
        ) => <T>(
            self: Effect<SignalArray<T>, never, Scope>,
        ) => Effect<SignalArray<T>, never, Scope>;
    }
    Index
    make: <T>(initial?: readonly T[]) => Effect<SignalArray<T>, never, Scope>

    Create a new SignalArray with an optional initial value.

    Type Declaration

      • <T>(initial?: readonly T[]): Effect<SignalArray<T>, never, Scope>
      • Type Parameters

        • T

        Parameters

        • initial: readonly T[] = []

          The initial array (defaults to empty)

        Returns Effect<SignalArray<T>, never, Scope>

    OutOfBoundsError: typeof OutOfBoundsError
    trace: (
        id: string,
    ) => <T>(
        self: Effect<SignalArray<T>, never, Scope>,
    ) => Effect<SignalArray<T>, never, Scope>

    Log every mutation call on a SignalArray at Debug level, tagged under the stax.signal subsystem, with the call site captured at the caller's frame.

    The write-side counterpart to Readable.debug, for SignalArray. Wraps every mutation method (push, pop, unshift, shift, splice, insertAt, removeAt, replaceAt, modifyAt, remove, move, swap, sort, reverse, clear, and the inherited Signal.set / Signal.update). Zero cost at the default log level — the check runs once at construction and returns the underlying signal unwrapped if Debug isn't enabled.

    Unlike Signal.trace (which logs from/to), collection tracing logs the method name and its arguments — a full snapshot of the array on every write would be expensive and rarely what you want. Pair with Readable.debug if you also want a "value changed" line.

    const todos = yield* Signal.Array.make<Todo>().pipe(
    Signal.Array.trace("todos"),
    );
    yield* todos.push({ id: 1, text: "buy milk" });
    // Debug logs:
    // stax.signal "push" { id: "todos", args: [{...}], callSite: "..." }