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

@infogata/extension-components

v0.1.0

Published

React context and hook for browser extension detection with polling

Readme

@infogata/extension-components

React context and hook for browser extension detection with configurable polling.

Installation

npm install @infogata/extension-components

Usage

Basic Setup

Wrap your application with ExtensionProvider and provide a hasExtension function that returns true when the extension is detected:

import { ExtensionProvider } from "@infogata/extension-components";

// Define your extension detection logic
const hasExtension = () => {
  return typeof window !== "undefined" && typeof window.MyExtensionAPI !== "undefined";
};

function App() {
  return (
    <ExtensionProvider hasExtension={hasExtension}>
      <YourApp />
    </ExtensionProvider>
  );
}

Using the Hook

import { useExtension } from "@infogata/extension-components";

function MyComponent() {
  const { extensionDetected } = useExtension();

  if (extensionDetected === null) {
    return <div>Checking for extension...</div>;
  }

  if (!extensionDetected) {
    return <div>Please install our browser extension</div>;
  }

  return <div>Extension detected! Full functionality available.</div>;
}

Custom Polling Configuration

<ExtensionProvider
  hasExtension={hasExtension}
  initialPollInterval={50}      // Poll every 50ms initially (default: 100ms)
  initialPollDuration={5000}    // Initial phase lasts 5 seconds (default: 3000ms)
  slowPollInterval={5000}       // After initial phase, poll every 5 seconds (default: 2000ms)
>
  <App />
</ExtensionProvider>

API

ExtensionProvider Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | children | React.ReactNode | required | Child components | | hasExtension | () => boolean | required | Function that returns true when extension is detected | | initialPollInterval | number | 100 | Polling interval in ms during initial phase | | initialPollDuration | number | 3000 | Duration of initial aggressive polling phase in ms | | slowPollInterval | number | 2000 | Polling interval in ms after initial phase |

useExtension Return Value

| Property | Type | Description | |----------|------|-------------| | extensionDetected | boolean \| null | null during initial detection, true if detected, false if not detected |

How It Works

  1. On mount, immediately checks for extension
  2. If not immediately detected, polls at initialPollInterval for initialPollDuration
  3. After initial phase, sets extensionDetected to false but continues polling at slowPollInterval
  4. Once detected, stops polling and sets extensionDetected to true

This allows for fast detection when the extension loads quickly, while still detecting extensions that load after the page.

Type Exports

import type {
  ExtensionProviderProps,
  ExtensionContextType
} from "@infogata/extension-components";

License

MIT