turbodombuilder - v0.9.48
    Preparing search index...

    Class TurboController<ElementType, ViewType, ModelType, EmitterType>

    TurboController

    The MVC base controller class. Its main job is to handle some part of (or all of) the logic of the component. It has access to the element, the model to read and write data, the view to update the UI, and the emitter to listen for changes in the model or any other internal events. It can only communicate with other controllers via the emitter (by firing or listening for changes on a certain key).

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

      • ElementType extends object = object

        The type of the main component.

      • 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>,
                >,
            >,
        >

        The element's MVC view type.

      • 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>,
        >

        The element's MVC model type.

      • EmitterType extends TurboEmitter<
            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 element's MVC emitter type.

      Returns TurboController<ElementType, ViewType, ModelType, EmitterType>

    Properties

    keyName: string

    The key of the controller. Used to retrieve it in the main component. If not set, if the element's class name is MyElement and the controller's class name is MyElementSomethingController, the key would default to "something".

    element: ElementType

    The element it is bound to.

    view: ViewType

    The MVC view.

    model: ModelType

    The MVC model.

    emitter: EmitterType

    The MVC emitter.

    Methods

    • Protected Function

      setup

      Returns void

      Called in the constructor. Use for setup that should happen at instantiation, before this.initialize() is called.

    • Function

      initialize

      Returns void

      Initializes the controller. Specifically, it will set up the change callbacks.

    • Protected Function

      setupUIListeners

      Returns void

      Setup method for defining DOM and input event listeners.

    • Protected Function

      setupChangedCallbacks

      Returns void

      Setup method intended to initialize change listeners and callbacks.