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

true-link

v0.1.0

Published

Tiny zero-config network truth detector. Detects real connectivity over navigator.onLine via fetch ping with timeout. Catches lie-fi, classifies connection strength.

Readme

true-link

Tiny zero-config network truth detector. Catches lie-fi, classifies connection strength.

npm version npm downloads license tests Boosty Crypto

navigator.onLine lies in 30% of cases on mobile. true-link uses fetch-ping with timeout to detect real connectivity, classifies as strong | weak | offline, and catches lie-fi before your users notice.

Zero runtime deps, framework adapters included, SSR-safe.

npm i true-link
# or: yarn add true-link
# or: pnpm add true-link

Quick Start

Minimal flow: import → create → subscribe → get { isOnline, strength, latency }.

import { createTrueLink } from "true-link/vanilla";

const tl = createTrueLink({ pingUrl: "/health" });

const unsub = tl.subscribe((v) => {
    if (!v) return;

    console.log(
        `online=${v.isOnline} strength=${v.strength} latency=${v.latency}ms`
    );
});

// later:
// unsub();
// tl.destroy();

Demo snippet

Use this in a real page (Vite/Parcel/Next). Toggle your network to see it react.

<div id="app" style="padding:16px">
  <pre id="out">loading…</pre>
</div>

<script type="module">
  import { createTrueLink } from "true-link/vanilla";

  const out = document.getElementById("out");
  Object.assign(out.style, {
    padding: "12px 16px",
    font: "14px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
    background: "#111",
    color: "#0f0",
    borderRadius: "8px",
  });

  const tl = createTrueLink({ pingUrl: "/favicon.ico" });

  tl.subscribe((v) => {
    if (!v) {
      out.textContent = "SSR / null";
      return;
    }
    out.textContent =
`online:   ${v.isOnline}
strength: ${v.strength}
latency:  ${v.latency ?? "n/a"}ms
checking: ${v.isChecking}`;
  });
</script>

Features

A few concrete, technical reasons it behaves well:

  • Catches lie-fi: Ping timeout classifies slow/unstable networks as weak or offline.
  • Zero runtime deps: 0 dependencies at runtime (tree-shakeable ESM).
  • Connection strength: strong | weak | offline based on latency, not just boolean online/offline.
  • SSR-safe: Returns null on server, works with React 18 useSyncExternalStore.

API (short)

Core snapshot fields you'll typically use:

  • isOnlinetrue if strength !== 'offline'
  • strength'strong' | 'weak' | 'offline'
  • latency — ping time in ms, or null if offline/checking
  • isCheckingtrue while ping is in flight

Vanilla store:

  • createTrueLink(options) from true-link/vanilla → creates a controller with get(), subscribe(), destroy()

Framework adapters:

  • React: useTrueLink from true-link/react
  • Vue: useTrueLink from true-link/vue
  • Svelte: trueLink from true-link/svelte
  • Solid: createTrueLink from true-link/solid
  • Angular: TrueLinkDirective from true-link/angular

Full types and signatures: see TypeScript IntelliSense or published dist/*.d.ts files.

Adapter Docs: ReactVueSvelteSolidAngular

Links

FAQCommon pitfallsSmoke testVersioning policy

Support the project

If this library saved you time, please consider supporting the development:

  1. Fiat (Cards/PayPal): via Boosty (one-time or monthly).
  2. Crypto (USDT/BTC/ETH): view wallet addresses on Telegram.

Support on Boosty Crypto via Telegram

License

MIT