Skip to content

Commit

Permalink
more readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
syropian committed Oct 26, 2022
1 parent 02d23c3 commit 0ff0fcf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,38 @@ console.log(listManager.get()) // [1, 2, 3, 4, 8]

Similar to `get()` but returns the indices of the selected items instead of the items themselves.

TODO
**Example**

```ts
const items = [
{ id: 1, name: 'Item 1' },
{ id: 2, name: 'Item 2' },
{ id: 3, name: 'Item 3' },
{ id: 4, name: 'Item 4' },
{ id: 5, name: 'Item 5' },
]

const listManager = new Lssm(items)
listManager.select(1).select(3, { shiftKey: true }).select(5, { metaKey: true })

console.log(listManager.getIndices()) // [0, 1, 2, 5]
```

#### `set(items: T[]): this`

Allows you to manually set the selected items in the list.

**Example**

```ts
const items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const listManager = new Lssm(items)

listManager.set([1, 5, 6, 7])

console.log(listManager.get()) // [1, 5, 6, 7]
```

#### `selectAll(): this`

Selects all items in the list.
Expand Down
8 changes: 5 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0ff0fcf

Please sign in to comment.