turbodombuilder - v0.9.5
    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, if initializing MVC.

    • DataType extends object = object

      The element's data type, if initializing MVC.

    • ModelType extends TurboModel = TurboModel

      The element's model type, if initializing MVC.

    • EmitterType extends TurboEmitter = TurboEmitter<any>

      The element's emitter type, if initializing MVC.

    Index

    Constructors

    Accessors

    • get model(): ModelType

      Returns ModelType

      The model (if any) of the current MVC structure. Setting it will de-link the previous model and link the new one to the current view (if any) and emitter (if any).

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

      Parameters

      Returns void

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

      Parameters

      Returns void

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

      Parameters

      Returns void

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

      Parameters

      Returns void

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

      Parameters

      Returns void

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

      Parameters

      Returns void

    • get data(): DataType

      Returns DataType

      The main data block (if any) attached to the element, taken from its 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) of the element, taken from its 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) of the element, taken from its 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) of the element, taken from its model (if any).

    Methods

    • 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".

    • addController

      Parameters

      Returns void

      Adds the given controller to the MVC structure.

    • 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".

    • addHandler

      Parameters

      Returns void

      Adds the given handler to the MVC structure.

    • 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".

    • addInteractor

      Parameters

      Returns void

      Adds the given interactor to the MVC structure.

    • 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".

    • addTool

      Parameters

      Returns void

      Adds the given tool to the MVC structure.

    • 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".

    • addSubstrate

      Parameters

      Returns void

      Adds the given substrate to the MVC structure.

    • Parameters

      Returns void

    • Returns void

    • generate

      Parameters

      Returns void

      Generates the MVC structure based on the provided properties. If no model or modelConstructor is defined, no model will be generated. Similarly for the view. If the structure contains a model, an emitter will be created, even if it is not defined in the properties.

    • initialize

      Returns void

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

    • Parameters

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

      Returns string