
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.