开发者社区> 镜像站> NPM> infinilist
infinilist
hui component for partial rendering big lists
Last updated 8 months ago by mafintosh .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install infinilist 
SYNC missed versions from official npm registry.

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

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`<li>${items[i]}</li>`
}

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.

Current Tags

  • 1.2.5                                ...           latest (8 months ago)

8 Versions

  • 1.2.5                                ...           8 months ago
  • 1.2.4                                ...           8 months ago
  • 1.2.3                                ...           8 months ago
  • 1.2.2                                ...           8 months ago
  • 1.2.1                                ...           8 months ago
  • 1.2.0                                ...           8 months ago
  • 1.1.0                                ...           8 months ago
  • 1.0.0                                ...           8 months ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)