Skip to content

afeiship/next-activeable-data-list

Repository files navigation

next-activeable-data-list

Next data list with active index.

version license size download

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.

Releases

No releases published

Packages

No packages published