
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@bogdanbeniaminb/virtualized-list
Advanced tools
A simple Virtualized List using vanilla JS.
Just install the package from npm:
npm install --save @bogdanbeniaminb/virtualized-list
You will need:
import VirtualizedList from '@bogdanbeniaminb/virtualized-list';
const listItems = [
{
id: 1,
title: 'First',
},
{
id: 2,
title: 'Second',
},
];
// Make sure this element exists on the page and that it has a fixed height.
const wrapper = document.querySelector('.virtualized-list-wrapper');
const virtualizedList = new VirtualizedList({
listElement: wrapper,
itemHeight: 35, // optional
items: listItems,
itemRenderer: (item) => {
const itemElement = document.createElement('div');
itemElement.innerHTML = item.title;
return itemElement;
},
itemKeyGetter: (item) => item.id, // optional
});
listElement
(HTMLElement, required) - the list containeritemHeight
(number, optional) - the estimated item heightitems
(array of objects, required) - the items to displayitemRenderer
(function, required) - accepts 1 or 2 parameters, the first one being the current item, and should return a HTMLElementitemKeyGetter
(function, optional) - a function which accepts the item and returns a unique ID. If not provided, the library will search for: 1) the id
field of the item; 2) the key
field of the item; 3) the actual index of the item in the array.updateItems(items: T[])
- update the whole array of items. Use this if you want to dynamically change the items. It will be similar to a reset.FAQs
Virtualized List using vanilla JS
We found that @bogdanbeniaminb/virtualized-list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.