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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mark1russell7/lag-hud

v0.4.0

Published

An in-memory meter, a fan-out and a display without a framework for the lag monitors of @mark1russell7/lag.

Readme

@mark1russell7/lag-hud

An in-memory meter, a fan-out and a small display for the lag monitors of @mark1russell7/lag. The display needs no framework, so it works in a page of each framework.

npm install @mark1russell7/lag-hud @mark1russell7/lag

Use

import { createBrowserDeps, setupAllMonitors } from "@mark1russell7/lag";
import { createHudMeter, mountLagHud } from "@mark1russell7/lag-hud";

const hud = createHudMeter();
const monitors = setupAllMonitors(createBrowserDeps(window, { meter: hud.meter, logger }));
const display = mountLagHud(hud, { corner: "bottom-right" });
// later: display.stop(); monitors.stop();

The meter

lag reports through a Meter with the shape of the OpenTelemetry Meter. createHudMeter() gives a meter that keeps the values in memory.

  • A histogram keeps its last windowSize values (default 200), and it counts each value.
  • A counter keeps its total.
  • snapshot() gives a LagStat for each metric: count, last, p50, p95, max and sum.
  • onChange(listener) starts the listener at most one time for each tickMs (default 1000). Thus a display updates at a calm rate, also when the monitors are busy.

More meters

fanOutMeter(...meters) gives one meter that records into each meter of the list. Use it to send the values to the display and to OpenTelemetry:

const meter = fanOutMeter(hud.meter, otelMeterProvider.getMeter("lag"));

fanOutMeter and the meter types have their home in @mark1russell7/lag/meters. This package exports them again. The types come from @opentelemetry/api, so this package has @opentelemetry/api as a peer dependency.

The display

mountLagHud(hud, options) adds a small fixed panel to the page: a title line, then one line for each metric. formatLagStat gives the line of one metric. lagHudText gives the text of the panel, for a display of your own.

| Option | What it does | | --- | --- | | corner | The corner of the screen: top-left, top-right, bottom-left or bottom-right (the default) | | title | The first line (default lag) | | parent | The parent element (default the body of the document) | | document | The document (default globalThis.document) |

stop() removes the panel and stops its updates.

License

MIT