Component

Component

Class representing a Base Component node. See Components.

Members

mirlo :Object

Description:
  • The object for mirlo purpuoses.

Source:
Properties:
Name Type Description
options Object

The component options.

The object for mirlo purpuoses.

Type:
  • Object

root :ShadowRoot|HTMLElement

Description:
  • Get the root node of the component

Source:

Get the root node of the component

Type:
  • ShadowRoot | HTMLElement

Methods

getFetchData(ref_name)

Description:
  • Get Fetch Data results.

Source:
Parameters:
Name Type Description
ref_name string

= The fetch data reference name.

onAttributeChanged(name, old_value, new_value)

Description:
  • Invoked when the component changes an attribute.

Source:
Parameters:
Name Type Description
name string

The attribute name.

old_value string

The old value.

new_value string

The new value.

onRemove()

Description:
  • Invoked when the component is removed from the page.

Source:

onSetup()

Description:
  • Invoked when the component is allocated. Use this method to call 'Hook Functions' and configure the component.

Source:

onStart()

Description:
  • Invoked when 'onWillStart' promise finish. Here you can manipulate the component node.

Source:

onStateChanged(prop, old_value, new_value)

Description:
  • Invoked when the component state change.

Source:
Parameters:
Name Type Description
prop string

The property name.

old_value any

The old value.

new_value any

The new value.

onWillStart() → {Promise}

Description:
  • Invoked when the component is attached to the page. Used to call promises and wait for them before full initialization.

Source:
Returns:
Type
Promise

query(selector) → {HTMLElement}

Description:
  • Query a node using an CSS selector.

Source:
Parameters:
Name Type Description
selector string

The CSS selector.

Returns:
Type
HTMLElement

queryAll(selector) → {NodeList}

Description:
  • Query all nodes using an CSS selector.

Source:
Parameters:
Name Type Description
selector string

The CSS selector.

Returns:
Type
NodeList

queryId(el_id) → {HTMLElement}

Description:
  • Query a node using its id.

Source:
Parameters:
Name Type Description
el_id string

The id of the node.

Returns:
Type
HTMLElement

renderTemplate()

Description:
  • Render the associated template. A template is created using the node 'template' with an 'id' like "template-mirlo-".

Source:

(static) disableShadow()

Description:
  • Disable Shadow Root. Not recommended if html templates are used.

Source:
Throws:

Will throw an error if the method is called outside allocation time.

(static) getActiveComponent() → {Component}

Description:
  • Gets the active allocated component.

Source:
Throws:

Will throw an error if the method is called outside allocation time.

Returns:
Type
Component

(static) updateStateBind(node, attr, value)

Description:
  • Update the node with the state bind change.

Source:
Parameters:
Name Type Description
node HTMLElement

The node.

attr string

The attribute name.

value string

The value.

(static) useEvents(event_defs)

Description:
  • Configure component events.

Source:
Parameters:
Name Type Description
event_defs Object

The event definition.

Throws:

Will throw an error if the method is called outside allocation time.

(static) useFetchData(fetch_defs)

Description:
  • Configure component fetch data.

Source:
Parameters:
Name Type Description
fetch_defs Object

The fetch data definition.

Throws:

Will throw an error if the method is called outside allocation time.

(static) useStateBinds(state_defs)

Description:
  • Configure component state binds.

Source:
Parameters:
Name Type Description
state_defs Object

The state bind definition.

Throws:

Will throw an error if the method is called outside allocation time.

(static) useStyles(…rel_hrefs)

Description:
  • Add external styles. Only useful if not uses disableShadow

Source:
Parameters:
Name Type Attributes Description
rel_hrefs string <repeatable>

The href of the stylesheet link.

Throws:

Will throw an error if the method is called outside allocation time.