@kayahr/signal
    Preparing search index...

    Function createMemo

    • Creates a lazy memoized computation derived from other signals or memos.

      The computation only runs when the getter is read and one of its dependencies changed.

      Dependencies are tracked dynamically from the values read during the last execution of func.

      Memos can be manually disposed. When created inside a scope, they are also disposed with that scope. Reading a disposed memo throws SignalError.

      Scope-less memos still work, but once a memo has been read it stays subscribed to its current dependencies until it is disposed. If the memo depends on long-lived state and needs deterministic cleanup, create it inside a scope.

      Type Parameters

      • T

      Parameters

      • func: () => T

        Computes the memo value from other signals or memos.

      • options: CreateMemoOptions<T> = {}

        Optional memo behavior overrides.

      Returns DisposableGetter<T>

      A getter for the memoized value.