Package Exports
- infinite-elements
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (infinite-elements) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
infinite-elements
A reusable module for creating infinite lists of elements where only the visible rows are rendered.
Work in progress
This is an early version that could likely break or have breaking changes!
Known issues
- this does not yet work with rows of variable height
Install
npm install --save infinite-elementsUsage
var html = require('bel')
var infiniteElements = require('infinite-elements')
var rows = []
// generate some rows for demonstration purposes
for (var i = 0; i < 500; i++) {
rows.push(i)
}
function eachRow (i) {
return html`<div id="row-${i}" style="height: 30px;">
this is row ${i}
</div>`
}
var render = infiniteElements({
height: 300,
rowHeight: 30,
eachRow: eachRow
})
var tree = render(rows)
document.body.appendChild(tree)
// If you need to rerender the list:
tree.render(rows)
// useful if you add/remove/change elements in the rows arrayExamples
See also
This module is inspired by / partially extracted from view-list.