turbodombuilder - v0.9.66
    Preparing search index...

    Function addRegistryCategory

    • Function

      addRegistryCategory

      Parameters

      • type: new (...args: any[]) => object

        The base class constructor to associate with a category.

      • Optionalcategory: RegistryCategory

        The category to associate with the class. Defaults to the class name if omitted, which is useful when the class name matches a RegistryCategory value.

      Returns void

      Associates a class constructor with a RegistryCategory in the TurboDom registry's category inference map. When define is called on a subclass, it walks the prototype chain and uses this map to determine the appropriate category without requiring direct imports of the base classes (which would cause circular dependencies).

      This should be called once per base class, after its definition, by the TurboDom internals. User-defined subclasses do not need to call this — category inference propagates automatically through the prototype chain.

      // At the bottom of turboModel.ts, after class definition:
      addRegistryCategory(TurboModel, RegistryCategory.TurboModel);

      // Later, when a subclass is defined:
      class MyModel extends TurboModel { ... }
      define(MyModel, "MyModel"); // infers RegistryCategory.TurboModel automatically