Nude Element API Docs - v0.1.3
    Preparing search index...

    Class Computed

    A computed signal that auto-tracks dependencies by intercepting .value reads during its compute function. Re-tracks on each recomputation, so dynamic/conditional dependencies work.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Parameters

      • fn: Function

        Compute function. All Signal .value reads inside this function are auto-tracked as dependencies.

      • Optionaloptions: any

        Forwarded to Signal (e.g. equals).

      Returns Computed

    Accessors

    • get value(): any

      Returns any

    • set value(_v: any): void

      Parameters

      • _v: any

      Returns void

    Methods

    • Overridable equality check. Defaults to ===.

      Parameters

      • a: any
      • b: any

      Returns boolean

    • Recompute if dirty. Called by the batch flush scheduler and also available for eager evaluation.

      Returns void

    • Subscribe to value changes. Returns an unsubscribe function.

      Parameters

      • fn: Function

        Called with (newValue, oldValue) on change

      Returns Function

      Unsubscribe function