turbodombuilder - v0.9.48
    Preparing search index...

    Class TurboTool<ElementType, ViewType, ModelType, EmitterType>

    TurboTool

    Class representing a tool in MVC, bound to the provided element.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

      • ElementType extends object = object

        The type of the element.

      • 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 view type, if any.

      • 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 model type, if any.

      • 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 emitter type, if any.

      Returns TurboTool<ElementType, ViewType, ModelType, EmitterType>

    Properties

    element: ElementType

    The element it is bound to.

    view: ViewType

    The MVC view.

    model: ModelType

    The MVC model.

    emitter: EmitterType

    The MVC emitter.

    keyName: string

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

    toolName: string

    The name of the tool.

    embeddedTarget: Node

    The target of this tool. If defined, will embed the tool.

    The associated event manager. Defaults to TurboEventManager.instance.

    activationEvent: string = DefaultEventName.click

    Custom activation event to listen to. Defaults to the default click event name.

    clickMode: ClickMode = ClickMode.left

    Click mode that will hold this tool when activated. Defaults to ClickMode.left.

    key: string

    Optional keyboard key to map to this tool. When pressed, it will be set as the current key tool.

    Methods

    • Protected Function

      setup

      Returns void

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

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

    • Function

      initialize

      Returns void

      Initialization function that calls makeTool on this.element, sets it up, and attaches all the defined tool behaviors.

    • Function

      customActivation

      Parameters

      • element: Turbo<Element>

        The tool element itself.

      • Optionalmanager: TurboEventManager

        The event manager instance this tool should register against. Defaults to TurboEventManager.instance.

      Returns void

      Custom activation function.

    • Function

      onActivate

      Returns void

      Function to execute when the tool is activated.

    • Function

      onDeactivate

      Returns void

      Function to execute when the tool is deactivated.