Value list is a component to build user interface, an instance of Component module.
npm install mag-component-value-list
Add the constructor to the scope:
var ValueList = require('mag-component-value-list');
Create value list instance:
var valueList = new ValueList({
data: [11, 22, 35, 56, 78],
cycle: true,
render: function ( $body ) {
$body.innerText = 'Number: ' + this.current.value;
},
events: {
// current state was changed
'data:change': function ( event ) {
console.log(event);
}
}
});
To get current state:
console.log(valueList.current);
There is a global var
DEVELOP
which activates additional consistency checks and protection logic not available in release mode.
If you have any problems or suggestions please open an issue according to the contribution rules.
mag-component-value-list
is released under the MIT License.