Client-Side Framework and Components / Snippets-components relationship |
data-* attributes can trigger events in components.
When a data-* value is changing, the related <component>.snippetData.* function is called.
The Client-Side Framework calls snippetData functions that way: snippetData.*(newValue, previousValue)
If the newValue argument is null, this mean that the related data-* attribute has to be removed.
If the previousValue argument is null, this mean that the related data-* attribute has been created.
In the following example, the changing of the SBRE value path will trigger the snippetData.gValue function of the related component.
Snippet markup:
<input data-g-value='{value}' />
this.snippetData.gValue = function(value) { myInputElement.value = value; }