Loading...
DataEffect JS
Use the DataEffect component to execute side effects when the value of the Data... components group changes. This component extends the DataBind component, so it inherits from its API.
Table of content
Usage
html
<!-- Two ways binding on the "text" group for the input's value -->
<!-- And show an alert if the content of the input is too loong -->
<input
type="text"
data-component="DataModel DataEffect"
data-option-group="text"
data-option-effect="value.length > 20 && alert('Too long')" />js
import { registerComponent } from '@studiometa/js-toolkit';
import { DataModel, DataEffect } from '@studiometa/ui';
registerComponent(DataModel);
registerComponent(DataEffect);