turbodombuilder - v0.9.22
    Preparing search index...

    Class Mvc<ElementType, ViewType, DataType, ModelType, EmitterType>

    Mvc

    MVC -- Model-View-Component -- handler. Generates and manages an MVC structure for a certain object.

    Type Parameters

    • ElementType extends object = object

      The type of the object that will be turned into MVC.

    • ViewType extends TurboView = TurboView<any, any>

      The element's view type.

    • DataType extends object = object

      The element's data type.

    • ModelType extends TurboModel = TurboModel

      The element's model type.

    • EmitterType extends TurboEmitter = TurboEmitter<any>

      The element's emitter type.

    Index

    Constructors

    • Type Parameters

      • ElementType extends object = object
      • ViewType extends TurboView<
            object,
            TurboModel<
                any,
                any,
                any,
                "map"
                | "array",
                TurboDataBlock<any, any, any, any, any>,
            >,
            TurboEmitter<
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
            >,
        > = TurboView<
            any,
            any,
            TurboEmitter<
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
            >,
        >
      • DataType extends object = object
      • ModelType extends TurboModel<
            any,
            any,
            any,
            "map"
            | "array",
            TurboDataBlock<any, any, any, any, any>,
        > = TurboModel<
            any,
            any,
            any,
            "map"
            | "array",
            TurboDataBlock<any, any, any, any, any>,
        >
      • EmitterType extends TurboEmitter<
            TurboModel<
                any,
                any,
                any,
                "map"
                | "array",
                TurboDataBlock<any, any, any, any, any>,
            >,
        > = TurboEmitter<any>

      Returns Mvc<ElementType, ViewType, DataType, ModelType, EmitterType>

    Properties

    element: ElementType

    The element/root of the MVC structure.

    Accessors

    • get model(): ModelType

      Returns ModelType

      The model (if any) of the current MVC structure. Setting it will update the model and link it with the existing pieces.

    • set model(
          model:
              | ModelType
              | (new (data?: any, dataBlocksType?: "map" | "array") => ModelType),
      ): void

      Parameters

      Returns void

    • get emitter(): EmitterType

      Returns EmitterType

      The emitter (if any) of the current MVC structure. Setting it will update the emitter and link it with the existing pieces.

    • set emitter(
          emitter: EmitterType | (new (properties: ModelType) => EmitterType),
      ): void

      Parameters

      Returns void

    • get controllers(): TurboController<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      Returns TurboController<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      The controllers (if any) of the current MVC structure. Setting it will not override the existing controllers, but only add the new values and link them with the existing pieces.

    • set controllers(
          value: MvcManyInstancesOrConstructors<
              TurboController<
                  object,
                  TurboView<
                      any,
                      any,
                      TurboEmitter<
                          TurboModel<
                              any,
                              any,
                              any,
                              "map"
                              | "array",
                              TurboDataBlock<any, any, any, any, any>,
                          >,
                      >,
                  >,
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
                  TurboEmitter<
                      TurboModel<
                          any,
                          any,
                          any,
                          "map"
                          | "array",
                          TurboDataBlock<any, any, any, any, any>,
                      >,
                  >,
              >,
              TurboControllerProperties,
          >,
      ): void

      Parameters

      • value: MvcManyInstancesOrConstructors<
            TurboController<
                object,
                TurboView<
                    any,
                    any,
                    TurboEmitter<
                        TurboModel<
                            any,
                            any,
                            any,
                            "map"
                            | "array",
                            TurboDataBlock<any, any, any, any, any>,
                        >,
                    >,
                >,
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
                TurboEmitter<
                    TurboModel<
                        any,
                        any,
                        any,
                        "map"
                        | "array",
                        TurboDataBlock<any, any, any, any, any>,
                    >,
                >,
            >,
            TurboControllerProperties,
        >

      Returns void

    • get handlers(): TurboHandler<
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
      >[]

      Returns TurboHandler<
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
      >[]

      The handlers (if any) of the current MVC structure. Setting it will not override the existing handlers, but only add the new values and link them with the existing pieces.

    • set handlers(
          value: MvcManyInstancesOrConstructors<
              TurboHandler<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
      ): void

      Parameters

      • value: MvcManyInstancesOrConstructors<
            TurboHandler<
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
            >,
        >

      Returns void

    • get interactors(): TurboInteractor<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      Returns TurboInteractor<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      The interactors (if any) of the current MVC structure. Setting it will not override the existing interactors, but only add the new values and link them with the existing pieces.

    • set interactors(
          value: MvcManyInstancesOrConstructors<
              TurboInteractor<
                  object,
                  TurboView<
                      any,
                      any,
                      TurboEmitter<
                          TurboModel<
                              any,
                              any,
                              any,
                              "map"
                              | "array",
                              TurboDataBlock<any, any, any, any, any>,
                          >,
                      >,
                  >,
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
                  TurboEmitter<
                      TurboModel<
                          any,
                          any,
                          any,
                          "map"
                          | "array",
                          TurboDataBlock<any, any, any, any, any>,
                      >,
                  >,
              >,
              TurboInteractorProperties,
          >,
      ): void

      Parameters

      • value: MvcManyInstancesOrConstructors<
            TurboInteractor<
                object,
                TurboView<
                    any,
                    any,
                    TurboEmitter<
                        TurboModel<
                            any,
                            any,
                            any,
                            "map"
                            | "array",
                            TurboDataBlock<any, any, any, any, any>,
                        >,
                    >,
                >,
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
                TurboEmitter<
                    TurboModel<
                        any,
                        any,
                        any,
                        "map"
                        | "array",
                        TurboDataBlock<any, any, any, any, any>,
                    >,
                >,
            >,
            TurboInteractorProperties,
        >

      Returns void

    • get tools(): TurboTool<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      Returns TurboTool<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      The tools (if any) of the current MVC structure. Setting it will not override the existing tools, but only add the new values and link them with the existing pieces.

    • set tools(
          value: MvcManyInstancesOrConstructors<
              TurboTool<
                  object,
                  TurboView<
                      any,
                      any,
                      TurboEmitter<
                          TurboModel<
                              any,
                              any,
                              any,
                              "map"
                              | "array",
                              TurboDataBlock<any, any, any, any, any>,
                          >,
                      >,
                  >,
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
                  TurboEmitter<
                      TurboModel<
                          any,
                          any,
                          any,
                          "map"
                          | "array",
                          TurboDataBlock<any, any, any, any, any>,
                      >,
                  >,
              >,
              TurboToolProperties,
          >,
      ): void

      Parameters

      • value: MvcManyInstancesOrConstructors<
            TurboTool<
                object,
                TurboView<
                    any,
                    any,
                    TurboEmitter<
                        TurboModel<
                            any,
                            any,
                            any,
                            "map"
                            | "array",
                            TurboDataBlock<any, any, any, any, any>,
                        >,
                    >,
                >,
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
                TurboEmitter<
                    TurboModel<
                        any,
                        any,
                        any,
                        "map"
                        | "array",
                        TurboDataBlock<any, any, any, any, any>,
                    >,
                >,
            >,
            TurboToolProperties,
        >

      Returns void

    • get substrates(): TurboSubstrate<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      Returns TurboSubstrate<
          object,
          TurboView<
              any,
              any,
              TurboEmitter<
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
              >,
          >,
          TurboModel<
              any,
              any,
              any,
              "map"
              | "array",
              TurboDataBlock<any, any, any, any, any>,
          >,
          TurboEmitter<
              TurboModel<
                  any,
                  any,
                  any,
                  "map"
                  | "array",
                  TurboDataBlock<any, any, any, any, any>,
              >,
          >,
      >[]

      The substrates (if any) of the current MVC structure. Setting it will not override the existing substrates, but only add the new values and link them with the existing pieces.

    • set substrates(
          value: MvcManyInstancesOrConstructors<
              TurboSubstrate<
                  object,
                  TurboView<
                      any,
                      any,
                      TurboEmitter<
                          TurboModel<
                              any,
                              any,
                              any,
                              "map"
                              | "array",
                              TurboDataBlock<any, any, any, any, any>,
                          >,
                      >,
                  >,
                  TurboModel<
                      any,
                      any,
                      any,
                      "map"
                      | "array",
                      TurboDataBlock<any, any, any, any, any>,
                  >,
                  TurboEmitter<
                      TurboModel<
                          any,
                          any,
                          any,
                          "map"
                          | "array",
                          TurboDataBlock<any, any, any, any, any>,
                      >,
                  >,
              >,
              TurboSubstrateProperties,
          >,
      ): void

      Parameters

      • value: MvcManyInstancesOrConstructors<
            TurboSubstrate<
                object,
                TurboView<
                    any,
                    any,
                    TurboEmitter<
                        TurboModel<
                            any,
                            any,
                            any,
                            "map"
                            | "array",
                            TurboDataBlock<any, any, any, any, any>,
                        >,
                    >,
                >,
                TurboModel<
                    any,
                    any,
                    any,
                    "map"
                    | "array",
                    TurboDataBlock<any, any, any, any, any>,
                >,
                TurboEmitter<
                    TurboModel<
                        any,
                        any,
                        any,
                        "map"
                        | "array",
                        TurboDataBlock<any, any, any, any, any>,
                    >,
                >,
            >,
            TurboSubstrateProperties,
        >

      Returns void

    • get data(): DataType

      Returns DataType

      The main data block (if any) attached to the model (if any).

    • set data(data: DataType): void

      Parameters

      Returns void

    • get dataId(): string

      Returns string

      The ID of the main data block (if any) attached to the model (if any).

    • set dataId(value: string): void

      Parameters

      • value: string

      Returns void

    • get dataIndex(): number

      Returns number

      The numerical index of the main data block (if any) attached to the model (if any).

    • set dataIndex(value: number): void

      Parameters

      • value: number

      Returns void

    • get dataSize(): number

      Returns number

      The size (number) of the main data block (if any) attached to the model (if any).

    Methods

    • Function

      getController

      Parameters

      • key: string

        The controller's key.

      Returns TurboController

      • The controller.

      Retrieves the attached MVC controller with the given key. By default, unless manually defined in the controller, if the element's class name is MyElement and the controller's class name is MyElementSomethingController, the key would be "something".

    • Function

      addController

      Parameters

      Returns void

      Adds the given controller to the MVC structure.

    • Function

      getHandler

      Parameters

      • key: string

        The handler's key.

      Returns TurboHandler

      • The handler.

      Retrieves the attached MVC handler with the given key. By default, unless manually defined in the handler, if the element's class name is MyElement and the handler's class name is MyElementSomethingHandler, the key would be "something".

    • Function

      addHandler

      Parameters

      Returns void

      Adds the given handler to the MVC structure.

    • Function

      getInteractor

      Parameters

      • key: string

        The interactor's key.

      Returns TurboInteractor

      • The interactor.

      Retrieves the attached MVC interactor with the given key. By default, unless manually defined in the interactor, if the element's class name is MyElement and the interactor's class name is MyElementSomethingInteractor, the key would be "something".

    • Function

      addInteractor

      Parameters

      Returns void

      Adds the given interactor to the MVC structure.

    • Function

      getTool

      Parameters

      • key: string

        The tool's key.

      Returns TurboTool

      • The tool.

      Retrieves the attached MVC Tool with the given key. By default, unless manually defined in the tool, if the element's class name is MyElement and the tool's class name is MyElementSomethingTool, the key would be "something".

    • Function

      addTool

      Parameters

      Returns void

      Adds the given tool to the MVC structure.

    • Function

      getSubstrate

      Parameters

      • key: string

        The substrate's key.

      Returns TurboSubstrate

      • The substrate.

      Retrieves the attached MVC Substrate with the given key. By default, unless manually defined in the substrate, if the element's class name is MyElement and the substrate's class name is MyElementSomethingSubstrate, the key would be "something".

    • Function

      addSubstrate

      Parameters

      Returns void

      Adds the given substrate to the MVC structure.

    • Function

      generate

      Parameters

      Returns void

      Generates the MVC structure based on the provided properties. If no model or model constructor is defined, no model will be generated. The same applies for the view. If not defined, a default emitter will be created.

    • Function

      initialize

      Returns void

      Initializes the MVC parts: the view, the controllers, the interactors, the tools, the substrates, and the model (in this order). The model is initialized last to allow for the view and controllers to set up their change callbacks.

    • Parameters

      Returns void

    • Returns void

    • Parameters

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

      Returns string