Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hyperdivision/infinilist

Scalable list element
https://github.com/hyperdivision/infinilist

Last synced: 18 days ago
JSON representation

Scalable list element

Awesome Lists containing this project

README

        

# Infinilist

> hui component for listing a millions of items, partially rendering only a
> viewport and viewport buffer amount of them, using a single intersection observer

## Usage example

``` js
const Infinilist = require('infinilist')
const html = require('hui/html')

const items = [ ...millionsOfItems ]

// render function passed down to list, requesting a rendered item at index
const renderItem (i) {
return html`

  • ${items[i]}
  • `
    }

    const list = new Infinilist(renderItem, { total: items.length })

    document.body.appendChild(list.element)
    ```

    ## API

    #### `list.resize(newTotalCount)`

    Update the total count after the element has been created

    #### `list.reset()`

    Recreates all currently showed elements. Useful if your underlying array changes.