Class: BaseComponent

BaseComponent

new BaseComponent()

The base class for all components
Source:

Members

children

getter for children which will automatically refresh them and create them if they are BaseComponent
Source:

commonProperties

getter for commonProperties which are shared against all components
Source:

Methods

_applyOptions(options, …names)

If you document a component properties like this: Component.PROPERTY = { X: function () { ... do something ... }, Y: function () { ... do something ... }, }; You can use this function that will iterate options object and for each component, calls the initialization where necessary. Usage (in constructor): this._applyOptions(options, "X", "Y");
Parameters:
Name Type Attributes Description
options
names string <repeatable>
keys to the options object, values of the keys should be functions
Source:

addChildren(…children)

Parameters:
Name Type Attributes Description
children any <repeatable>
children to add to the component
Source:

attachTo(element)

Parameters:
Name Type Description
element * The element to attach the component to
Source:

create()

Create the component it needs to be overridden by the derived class
Source:

refreshState()

Refresh the state of the component, e.g. class names
Source:

set(…properties)

Parameters:
Name Type Attributes Description
properties any <repeatable>
functions to set the state of the component
Source:

setClass(key, value)

Set the class of the component
Parameters:
Name Type Description
key string The key of the class
value string The value of the class
Source:
Example
button.setClass("size", "btn-lg");

BaseComponent

new BaseComponent(options, …args)

Parameters:
Name Type Attributes Description
options * other options are defined in the constructor of the derived class
args any <repeatable>
options.id string <optional>
The id of the component
Source:

Members

children

getter for children which will automatically refresh them and create them if they are BaseComponent
Source:

commonProperties

getter for commonProperties which are shared against all components
Source:

Methods

_applyOptions(options, …names)

If you document a component properties like this: Component.PROPERTY = { X: function () { ... do something ... }, Y: function () { ... do something ... }, }; You can use this function that will iterate options object and for each component, calls the initialization where necessary. Usage (in constructor): this._applyOptions(options, "X", "Y");
Parameters:
Name Type Attributes Description
options
names string <repeatable>
keys to the options object, values of the keys should be functions
Source:

addChildren(…children)

Parameters:
Name Type Attributes Description
children any <repeatable>
children to add to the component
Source:

attachTo(element)

Parameters:
Name Type Description
element * The element to attach the component to
Source:

create()

Create the component it needs to be overridden by the derived class
Source:

refreshState()

Refresh the state of the component, e.g. class names
Source:

set(…properties)

Parameters:
Name Type Attributes Description
properties any <repeatable>
functions to set the state of the component
Source:

setClass(key, value)

Set the class of the component
Parameters:
Name Type Description
key string The key of the class
value string The value of the class
Source:
Example
button.setClass("size", "btn-lg");