new StringAdapter( instanceName, content )

Description

An adapter for raw HTML.

Other Widgets may use this to wrap any HTML they may be handed so they do not need to special case their implementation outside of construction.

Parameters
Name Type Description
instanceName string

Name for this instance.

content string

Item to be adapted.

Members


container :external:Element


id :string

Details
string

logger :NexusHoratio.base.Logger


name :string


visible :boolean

Methods


build() → {NexusHoratio.widget.Widget}

Description

Materialize the contents into the container.

Each time this is called, the Widget should repopulate the contents.

Returns

This instance, for chaining.


destroy() → {NexusHoratio.widget.Widget}

Description

Tears down internals. E.g., any Widget that has other Widgets should call their destroy() method as well.

Returns

This instance, for chaining.


show() → {NexusHoratio.widget.Widget}

Description

Shows the Widget by removing a CSS class.

Returns

This instance, for chaining.


hide() → {NexusHoratio.widget.Widget}

Description

Hides the Widget by adding a CSS class.

Returns

This instance, for chaining.


verify() → {NexusHoratio.widget.Widget}

Description

Verifies a Widget's internal state.

For example, a Widget may use this to enforce certain ARIA criteria.

Returns

This instance, for chaining.


clear()

Description

Clears the container element.

Details

true


on( eventType, func ) → {NexusHoratio.widget.Widget}

Description

Attach a function to an eventType.

Parameters
Name Type Description
eventType string

Event type to connect with.

func NexusHoratio.base.Dispatcher~Handler

Single argument function to call.

Returns

This instance, for chaining.


off( eventType, func ) → {NexusHoratio.widget.Widget}

Description

Remove all instances of a function registered to an eventType.

Parameters
Name Type Description
eventType string

Event type to disconnect from.

func NexusHoratio.base.Dispatcher~Handler

Function to remove.

Returns

This instance, for chaining.


attrText( attr, value ) → {NexusHoratio.widget.Widget}

Description

Helper that sets an attribute to value.

If value is null, the attribute is removed.

Parameters
Name Type Attributes Description
attr string

Name of the attribute.

value string <nullable>

Value to assign.

Returns

This instance, for chaining.

Examples
w.attrText('aria-label', 'Information about the application.')

attrElements( attr, ...values ) → {NexusHoratio.widget.Widget}

Description

Helper that sets an attribute to space separated Element ids.

This will collect the appropriate id from each value passed then assign that collection to the attribute. If any value is null, the everything up to that point will be reset. If the collection ends up being empty (e.g., no values were passed or the last was null), the attribute will be removed.

Parameters
Name Type Attributes Description
attr string

Name of the attribute.

values NexusHoratio.widget~Content <nullable>
<repeatable>

Value to assign.

Returns

This instance, for chaining.


installStyle( id, rules ) → {external:HTMLStyleElement}

Description

Install a style if not already present.

It will NOT overwrite an existing one.

Parameters
Name Type Description
id string

Base to use for the style id.

rules Array.<string>

CSS rules in 'selector { declarations }'.

Returns

Resulting style element.

Events


build


built


verify


verified


destroy


destroyed


show


showed


hide


hidden