API Docs for:
Show:

LS.ComponentContainer Class

Module: LS

ComponentContainer class allows to add component based properties to any other class

Constructor

LS.ComponentContainer

()

Methods

addComponent

(
  • component
)
Object

Adds a component to this node. (maybe attach would been a better name)

Parameters:

  • component Object

Returns:

Object:

component added

configureComponents

(
  • info
)

Adds a component to this node.

Parameters:

  • info Object

    object containing all the info from a previous serialization

getComponent

(
  • component_class
  • index
)

Returns the first component of this container that is of the same class

Parameters:

  • component_class Object | String

    the class to search a component from (could be the class or the name)

  • index Number

    [optional] if you want the Nth component of this class

getComponentByIndex

(
  • component
)

Returns the component at index position

Parameters:

  • component Object

getComponentByUId

(
  • uid
)

Returns the component with the given uid

Parameters:

  • uid String

    the uid to search

getComponents

() Array

returns an array with all the components

Returns:

Array:

all the components

getIndexOfComponent

(
  • position
)

Returns the position in the components array of this component

Parameters:

  • position Number

    in the array, -1 if not found

hasComponent

(
  • component_class
  • search_missing
)

Returns if the container has a component of this class

Parameters:

  • component_class String | Class

    the component to search for, could be a string or the class itself

  • search_missing Boolean

    [optional] true if you want to search in the missing components too

processActionInComponents

(
  • action_name
  • params
)

executes the method with a given name in all the components

Parameters:

  • action_name String

    the name of the function to execute in all components (in string format)

  • params Array

    array with every parameter that the function may need

removeAllComponents

(
  • component
)

Removes all components from this node.

Parameters:

  • component Object

removeComponent

(
  • component
)

Removes a component from this node.

Parameters:

  • component Object

serializeComponents

(
  • o
)

Adds a component to this node.

Parameters:

  • o Object

    container where the components will be stored

setComponentIndex

(
  • component
)

Changes the order of a component

Parameters:

  • component Object