@jswork/next-activeable-data-list
v1.0.0
Published
Next data list with active index.
Downloads
3
Readme
next-activeable-data-list
Next data list with active index.
installation
npm install -S @jswork/next-activeable-data-list
apis
| api | params | description | |-----|--------|---------------| | get | - | Get current active item. | | to | - | Go to the input index. | | next | - | Go to next index. | | prev | - | Go to previous index. | | first | - | Go to first index. | | last | - | Go to last index. |
options
{ activeIndex: 0, continuous: false }
usage
import NxActiveableDataList from '@jswork/next-activeable-data-list';
const items = [
"item1",
"item2",
"item3",
"item4",
"item5",
"item6",
"item7",
"item8",
"item9",
];
const list = new NxActiveableDataList();
list.next(); // 1
list.next(); // 2
list.prev(); // 1
list.prev(); // 0
license
Code released under the MIT license.