Retree - v1.0.0
    Preparing search index...

    Function memo

    • Decorator that memoizes a getter on a ReactiveNode.

      Type Parameters

      Parameters

      • OptionalgetComparisons: (self: This) => unknown[] | undefined

      Returns (
          target: (this: This) => Value,
          context: ClassGetterDecoratorContext<This, Value>,
      ) => (this: This) => Value

      Pass a function that returns the comparisons array — the function captures this lazily, so the values are read fresh each time the getter is accessed.

      Cache semantics (matches ReactiveNode.memo):

      • No argument or returns undefined: recompute on every reproxy of the ReactiveNode.
      • Returns []: compute once, cache forever for this instance.
      • Returns [a, b, ...]: recompute on shallow-change.

      The cache key is the getter's property name, so each @memo-decorated getter has its own cell automatically.

      class ListFilter extends ReactiveNode {
      list: Card[] = [];
      searchText = "";

      @memo((self: ListFilter) => [self.list, self.searchText])
      get filteredList() {
      return this.list.filter((c) => c.text === this.searchText);
      }

      get dependencies() { return [this.dependency(this.list)]; }
      }