turbodombuilder - v0.9.22
    Preparing search index...

    Class TurboSubstrate<ElementType, ViewType, ModelType, EmitterType>

    TurboSubstrate

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

    Type Parameters

    Hierarchy (View Summary)

    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>,
                >,
            >,
        >
      • 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<
            TurboModel<
                any,
                any,
                any,
                "map"
                | "array",
                TurboDataBlock<any, any, any, any, any>,
            >,
        >

      Returns TurboSubstrate<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 substrate. Used to retrieve it in the main component. If not set, if the element's class name is MyElement and the substrate's class name is MyElementSomethingSubstrate, the key would default to "something".

    substrateName: string

    The name of the substrate.

    solverKeys: string[] = []

    The property keys of the substrate solvers defined in the instance.

    Accessors

    • get objectList(): Set<object>

      Returns Set<object>

      The list of objects constrained by the substrate. Retrieving it will return a shallow copy as a Set. Use addObject and removeObject to manipulate the list.

    • set objectList(value: Set<object> | HTMLCollection | NodeList): void

      Parameters

      Returns void

    Methods

    • Protected Function

      setupChangedCallbacks

      Returns void

      Setup method intended to initialize change listeners and callbacks.

    • Function

      initialize

      Returns void

      Initialization function that calls makeSubstrate on this.element, sets it up, and attaches all the defined solvers.

    • Function

      addObject

      Parameters

      • object: object

        The object to add.

      Returns void

      Adds the provided object to the substrate's list.

    • Function

      removeObject

      Parameters

      • object: object

        The object to remove.

      Returns void

      Removes the provided object from the substrate's list.

    • Function

      hasObject

      Parameters

      • object: object

        The object to check.

      Returns boolean

      • Whether the object is present.

      Whether the provided object is included in the substrate's list.

    • Function

      isProcessed

      Parameters

      • object: object

        The object to check.

      Returns boolean

      • Whether the object was processed.

      Whether the provided object is processed within the current resolving loop.

    • Function

      addSolver

      Parameters

      Returns void

      Add the given function as a solver in the substrate.

    • Function

      removeSolver

      Parameters

      Returns void

      Remove the given function from the substrate's list of solvers.

    • Function

      clearSolvers

      Returns void

      Remove all solvers attached to the substrate.

    • Function

      resolve

      Parameters

      Returns void

      Resolve the substrate by calling all the solvers on each of the objects in the substrate's list.

    • Function

      onActivate

      Returns void

      Function to execute when the substrate is activated.

    • Function

      onDeactivate

      Returns void

      Function to execute when the substrate is deactivated.