Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pkjy/virtual-list

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pkjy/virtual-list

A mini javascript virtual list library

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

virtual-list

A mini and zero dependency virtual list library. Just for practice, do NOT recommend using in prod env.

Installation

npm i @pkjy/virtual-list

Usage & API

Constructor
  • new VirtualList(options)
    • data: the content of list.Need an Array.
    • selector: the target element for the list. Defaults to body.
    • height: the height for the virtual list ViewPort. Defaults to 150.
    • itemHeight: the height for the virtual list component. Defaults to 15.
Methods
  • instance.push(data) Push new content to the VirtualList.
Event
  • todo: callback when scroll happens

Example

import { VirtualList } from '@pkjy/virtual-list'

const data = [...new Array(1000000).keys()]

const instance = new VirtualList({ data, selector: '#app', height: 300, itemHeight: 30  })

let idx = 0
setInterval(() => {
  instance.push(`------ new line ${idx} ------`)
  idx++
}, 2000)

License

MIT.

Keywords

FAQs

Package last updated on 08 Jul 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc