turbodombuilder - v0.9.66
    Preparing search index...

    Function nestedModelSignal

    • Function

      Parameters

      • ...keys: string[]

        The key path navigating to the nested model.

      Returns <Type extends object, Value>(
          value:
              | {
                  get?: (this: Type) => Value;
                  set?: (this: Type, value: Value) => void;
              }
              | ((initial: Value) => Value)
              | ((this: Type) => Value)
              | ((this: Type, v: Value) => void),
          context:
              | ClassFieldDecoratorContext<Type, Value>
              | ClassGetterDecoratorContext<Type, Value>
              | ClassSetterDecoratorContext<Type, Value>
              | ClassAccessorDecoratorContext<Type, Value>,
      ) => any

      nestedModelSignal

      Decorator that binds a reactive signal to a nested TurboModel instance at the given key path.

      • Getter returns the nested model instance via this.getNested(...keys).
      • Setter assigns the new value to the nested model's root data via this.getNested(...keys).data = value.
      class AppModel extends TurboModel {
      @nestedModelSignal("users", "42") user = undefined;
      }

      Is equivalent to:

      class AppModel extends TurboModel {
      @signal get user() { return this.getNested("users", "42"); }
      set user(value) { this.getNested("users", "42").data = value; }
      }