• Decorator for defining a Kos Data Model class.

    The decorator will prepare the class instance to use as a kOS Data Model meaning:

    1. The properties on the class will be observable meaning that any changes to them will be tracked and trigger updates to any subscribers.
    2. Methods will be treated as kOS Actions meaning that they will encapsulate any model mutations and will result in atomic updates to the model.
    3. The class will be able to register topic handlers to receive messages from the backend and from other models.
    4. The model will participate in the model lifecycle and will be initialized, activated, and disposed at the appropriate times.

    Type Parameters

    • T extends IKosDataModel = any
    • O extends object = Record<string, any>

    Parameters

    • id: string

      The unique identifier for the data model.

    Returns ((constructor) => any)

    A decorator function that defines a Kos Data Model class.

      • (constructor): any
      • Parameters

        • constructor: DecoratedKosModel<T>

        Returns any