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

signalrx

v1.0.33

Published

A lightweight library for managing signals as global reactive stores.

Readme

💡 SignalRX

SignalRX is a lightweight and highly optimized library for managing signals as global reactive stores in a simple, efficient, and intuitive way.


🚀 Installation

npm install signalrx
# or
yarn add signalrx

🧩 Example Usage

🧱 Create a Signal Store

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

export const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>({
  isAuthenticated: false,
  token: null,
} /* Initial State */);

📥 Get Data

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

export const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>({
  isAuthenticated: false,
  token: null,
});

/* Get the full store state */
const signalData = authSignalStore.getValue();

/* Get a partial value */
const token = authSignalStore.getValue(value => value.token);

/* Map to a custom object */
const newData = authSignalStore.getValue(value => ({
  valueToken: value.token,
  authenticated: value.isAuthenticated,
}));

⚙️ Update Data

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>({
  isAuthenticated: false,
  token: null,
});

/* Method 1: Update partially using a callback */
authSignalStore.setData(prev => ({ ...prev, token: "token example" }));

/* Method 2: Replace the entire store */
authSignalStore.setData({ isAuthenticated: true, token: "token example" });

📡 Subscribe to the Signal

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>({
  isAuthenticated: false,
  token: null,
});

/* Subscribe to changes */
const unsubscribe = authSignalStore.subscribe(value => {
  console.log(value); // { isAuthenticated: false, token: null }
});

The subscribe callback is automatically triggered whenever the signal value is updated through signal.setData().


🧽 Clear All Subscriptions

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>({
  isAuthenticated: false,
  token: null,
});

/* Clear all active subscriptions */
authSignalStore.clearSubscriptions();

⚙️ Signal Configuration

💾 Built-in Storage Configuration

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>(
  {
    isAuthenticated: false,
    token: null,
  },
  {
    storage: {
      name: "<your-storage-key>",
      storageType: "localstorage" | "sessionstorage" | "custom",
      values: {
        token: true,           // Save this property to storage
        isAuthenticated: false // Do not save this property
      },
    },
  } /* Signal config */
);

💾 Custom Storage Configuration

import { Signal } from "signalrx";

interface AuthSignalState {
  isAuthenticated: boolean;
  token: string | null;
}

const authSignalStore: Signal<AuthSignalState> = new Signal<AuthSignalState>(
  {
    isAuthenticated: false,
    token: null,
  },
  {
    storage: {
      name: "<your-storage-key>",
      storageType: "custom",
      customStorage: {
        getValue() {
          // Your custom implementation
        },
        setValue() {
          // Your custom implementation
        },
        deleteValue() {
          // Your custom implementation
        },
      },
    },
  } /* Signal config */
);

/* You can use the `CustomSignalConfigStorage<T>` interface to type your custom storage */

✅ Summary

  • getValue() → Retrieve the full or partial signal state.
  • setData() → Update or replace the current signal data.
  • subscribe() → Listen to signal changes in real-time.
  • clearSubscriptions() → Remove all active signal subscriptions.
  • storage → Persist specific values using localStorage, sessionStorage, or a custom storage engine.

💡 Key Features

  • Reactive — Signals update all subscribers automatically.
  • 💾 Persistent — Store values in browser storage easily.
  • 🧠 Type-safe — Fully typed with TypeScript generics.
  • 🧩 Modular — Works seamlessly in any frontend or backend environment.
  • 🪶 Lightweight — Zero dependencies, minimal footprint.

Contributing

If you want to contribute, please fork this repository and create a pull request. Direct pushes to main are not allowed.

📜 License

MIT © 2025 — Created with ❤️ by Joaquin Feola