Reference Source
public class | source

BaseComponent

Extends:

superClass → BaseComponent

The base element for all Coral components

Static Member Summary

Static Public Members
public static

Returns BaseComponent tracking options.

Member Summary

Public Members
public

Tracking of events.

public

The string representing the element name being tracked.

public

The string representing the feature being tracked.

Method Summary

Public Methods
public

get(property: String): *

Get the value of a property.

public

Hide this component.

public

off(eventName: String, selector: String, func: Function, useCapture: Boolean): BaseComponent

Remove an event listener.

public

on(eventName: String, selector: String, func: Function, useCapture: Boolean): BaseComponent

Add an event listener.

public

set(properties: Object<String, *>, silent: Boolean): BaseComponent

Set multiple properties.

public

Show this component.

public

Returns the component name.

public

trigger(eventName: String, props: Object, bubbles: Boolean, cancelable: Boolean): CustomEvent

Trigger an event.

Static Public Members

public static tracking: TrackingEnum: * source

Returns BaseComponent tracking options.

Return:

TrackingEnum

Public Members

public tracking: String source

Tracking of events. This provides insight on the usage of the components. It accepts "ON" and "OFF". In order to successfully track the events, {Tracking} needs to be configured.

  • TrackingEnum.ON by default.

public trackingElement: String source

The string representing the element name being tracked. This providex additional context to the trackers about the element that was interacted with.

  • "" by default.

public trackingFeature: String source

The string representing the feature being tracked. This provides additional context to the analytics trackers about the feature that the element enables.

  • "" by default.

Public Methods

public get(property: String): * source

Get the value of a property.

Params:

NameTypeAttributeDescription
property String

The name of the property to fetch the value of.

Return:

*

Property value.

public hide(): BaseComponent source

Hide this component.

Return:

BaseComponent

this, chainable

public off(eventName: String, selector: String, func: Function, useCapture: Boolean): BaseComponent source

Remove an event listener.

Params:

NameTypeAttributeDescription
eventName String

The event name to stop listening for.

selector String
  • optional

The selector that was used for event delegation.

func Function

The function that was passed to on().

useCapture Boolean
  • optional

Only remove listeners with useCapture set to the value passed in.

Return:

BaseComponent

this, chainable.

public on(eventName: String, selector: String, func: Function, useCapture: Boolean): BaseComponent source

Add an event listener.

Params:

NameTypeAttributeDescription
eventName String

The event name to listen for.

selector String
  • optional

The selector to use for event delegation.

func Function

The function that will be called when the event is triggered.

useCapture Boolean
  • optional
  • default: false

Whether or not to listen during the capturing or bubbling phase.

Return:

BaseComponent

this, chainable.

public set(properties: Object<String, *>, silent: Boolean): BaseComponent source

Set multiple properties.

Params:

NameTypeAttributeDescription
properties Object<String, *>

An object of property/value pairs to set.

silent Boolean

If true, events should not be triggered as a result of this set.

Return:

BaseComponent

this, chainable.

public show(): BaseComponent source

Show this component.

Return:

BaseComponent

this, chainable

public toString(): String source

Returns the component name.

Return:

String

public trigger(eventName: String, props: Object, bubbles: Boolean, cancelable: Boolean): CustomEvent source

Trigger an event.

Params:

NameTypeAttributeDescription
eventName String

The event name to trigger.

props Object
  • optional

Additional properties to make available to handlers as event.detail.

bubbles Boolean
  • optional
  • default: true

Set to false to prevent the event from bubbling.

cancelable Boolean
  • optional
  • default: true

Set to false to prevent the event from being cancelable.

Return:

CustomEvent

CustomEvent object