npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

infinity-component

v0.0.6

Published

infinite scrolling with loading and unloading

Readme

infinity

Unload and reload panes while scrolling. Inspired by airbnb/infinity.

Installation

Install with component(1):

$ component install component/infinity

Example

var infinity = require('infinity')(window);
var panes = document.querySelectorAll('.pane');

for(var i = 0, len = panes.length; i < len; i++) {
  infinity.add(panes[i]);
}

infinity.refresh();

Events

  • loading: called once before each visible el is loaded. useful for batch operations.
  • load: called when a el is to be loaded.
  • unloading: called once before each el is unloaded. useful for batch operations.
  • unload: called when an el is to be unloaded.

API

infinity(el)

Initialize infinity with el. el can be either the window or an element with overflow.

infinity.add(el, ...)

Add el to infinity. You may pass any number of arguments to be called with the load and unload functions. The first argument must be the element node.

infinity.add(view.el, view)

infinity.remove(el)

Remove an element from infinity.

infinity.remove(el)

infinity.load(fn)

Add a load function. Defaults to a noop. The arguments passed to add will be passed through load.

infinity.load(function(el, view) {
  // ...
});

infinity.unload(fn)

Add an unload function. Defaults to a noop. The arguments passed to add will be passed through unload.

infinity.unload(function(el, view) {
  // ...
});

infinity.refresh()

Refresh, loading and unloading elements. Call this after adding elements, removing elements, or moving elements programmatically.

infinity.refresh();

infinity.margin(n)

Add "preload margin" to each side of the container. This will allow you to start loading elements before they appear in viewport. n defaults to 0.

For example, for infinity.margin(200), the load function would trigger when the element is within 200px from being in view.

infinity.unbind()

Unbind all infinity events

License

MIT