Component API

A short list of the component API.

Note: While this documentation will highlight some of the APIs of the Client-Side Framework (CSF), it does not attempt to explain all of the APIs. The complete API reference is contained in the JavaScriptâ„¢ code and can be extracted using the JsDoc Toolkit.
Table 1. Component API
Component API Description
(Constructor function) Called when the CSF creates a component. At this point, the component element may not be connected the HTML document. Elements sizes may be zero and HTML parent hierarchy may not be reachable. (see initialize)
initialize Called when the component is created and present in the HTML document.
finalize Called when the component is about to be removed by the CSF.
handleSnippetState Deprecated.
isRemoved Returns true if the component is has been removed from the HTML document.
parentComponent Returns the parent component.
hasAncestors Returns true if the component is contained in the given component type, otherwise return false.
select Returns a single HTML element from the component element using a CSS selector. Refer to tk.selectAllElements in the file csf.js.
selectAll Returns a list of element elements from the component element using a CSS selector. Refer to tk.selectAllElements in the file csf.js.
listenEvent Listen for a given event on selected elements from the component element. The event listener is automatically removed when the component is destroyed. Refer to tk.listenEvent in the file csf.js.
dialogCallback Send a callback event that is called immediately or after the next engine response (if any). The call occurs only if the component still exist.
hasSnippetData Deprecated. Use element.data.* instead.
getSnippetData Deprecated. Use element.data.* instead.
elt (property) The component element is the HTML element that is at the origin of the component. The element has a data-g-id attribute.
data (property) An alias to this.elt.dataset