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

ferrsign

v0.0.4

Published

High-performance typed signals for frequent emissions

Readme

Ferrsign

Typed event emitter optimized for hot paths.

What

Signal/event library with separate classes for 0-3 arguments: Ferrsign0, Ferrsign1<A>, Ferrsign2<A, B>, Ferrsign3<A, B, C>.

Why separate classes

Performance on old devices (iPad Pro 1st gen, iOS 13, etc.) in frame loops.

A unified emit(...args) API would require:

  • Array allocation on every call
  • Spread operator when invoking callbacks

At 60fps with multiple signals per frame, this creates GC pressure and microstutters. Separate classes with explicit emit(a, b) calls avoid both.

Usage

import { Ferrsign0, Ferrsign1, Ferrsign2 } from "ferrsign";

const onTick = new Ferrsign1<number>();
const onClick = new Ferrsign2<number, number>();
const onComplete = new Ferrsign0();

onTick.on((dt) => { /* dt: number */ });
onClick.on((x, y) => { /* x: number, y: number */ });
onComplete.once(() => { /* ... */ });

// In loop
onTick.emit(deltaTime);
onClick.emit(pointerX, pointerY);
onComplete.emit();

API

All classes share the same interface:

  • on(callback) — subscribe
  • once(callback) — subscribe, auto-unsubscribe after first emit
  • off(callback) — unsubscribe
  • emit(...) — notify subscribers (argument count matches class)

Read-only views

For exposing signals without emit access:

import { Ferrsign1, FerrsignView1 } from "ferrsign";

class Player {
  private readonly _onDamage = new Ferrsign1<number>();
  
  get onDamage(): FerrsignView1<number> { 
    return this._onDamage; 
  }
}

const player = new Player();
player.onDamage.on((amount) => { /* ... */ }); // ✓
player.onDamage.emit(10);  // ✗ Error — no emit on view

Available views: FerrsignView0, FerrsignView1<A>, FerrsignView2<A, B>, FerrsignView3<A, B, C>.

Limitations

  • Max 3 arguments. If you need more, use an object:
  const onResize = new Ferrsign1<{ width: number; height: number }>();
  • First 10 subscribers stored in direct slots, rest in array. Optimized for typical case of 1-5 listeners per signal.
  • Dev-mode checks (duplicate subscription, unsubscribing non-existent callback) stripped in production build.

Safe during emit

Subscribing/unsubscribing during emit is handled correctly:

  • New subscriptions are deferred until emit completes
  • Removals mark slots for cleanup, no skipped/double calls