Value list component
Value list is a component to build user interface, an instance of Component module.
Installation
npm install mag-component-value-list
Usage
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);
Development mode
There is a global var
DEVELOP
which activates additional consistency checks and protection logic not available in release mode.
Contribution
If you have any problems or suggestions please open an issue according to the contribution rules.
License
mag-component-value-list
is released under the MIT License.