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

@eserstack/events

v5.1.0

Published

Readme

📡 @eserstack/events

Note: JSR is frozen at 4.5.x. From 5.0.0, @eserstack/events is published on npm under the same name (pnpm add @eserstack/events); the JSR versions stay available but get no updates.

eserstack Foundation — eser/stack on GitHub Install: pnpm add @eserstack/events

Type-safe event handling with a fluent API built on top of the DOM EventTarget.

Features

  • Fluent API: Chainable event registration with add() and remove()
  • Type-Safe Dispatch: Dispatch custom events with typed payloads
  • Global Registry: Pre-configured global event system for convenience
  • DOM Compatible: Built on standard EventTarget for familiar behavior

Quick Start

import * as events from "@eserstack/events";

// Register event listeners
events.registry
  .add("user:login", (e) =>
    console.log("User logged in:", (e as CustomEvent).detail),
  )
  .add("user:logout", () => console.log("User logged out"));

// Dispatch events with data
events.dispatcher.dispatch("user:login", { detail: { userId: 123 } });

// One-time listeners
events.registry.add("init", () => console.log("Initialized"), { once: true });

Custom Event Registry

import * as events from "@eserstack/events";

// Create an isolated event system
const myEvents = new events.Registry();

myEvents.add("data:update", (e) => {
  console.log("Data updated:", (e as CustomEvent).detail);
});

const dispatcher = myEvents.build();
dispatcher.dispatch("data:update", { detail: { id: 1, value: "new" } });

Removing Listeners

import * as events from "@eserstack/events";

const registry = new events.Registry();

const handler = (e: Event) => console.log(e);
registry.add("click", handler);
registry.remove("click", handler);

API Reference

Registry

| Method | Description | | ---------------------------------- | -------------------------------------- | | add(type, listener, options?) | Add event listener (chainable) | | remove(type, listener, options?) | Remove event listener (chainable) | | build() | Create a Dispatcher from this registry |

Dispatcher

| Method | Description | | -------------------------------- | ----------------------- | | dispatch(type, eventInitDict?) | Dispatch a custom event |

Global Exports

| Export | Description | | ------------ | -------------------------------------- | | registry | Pre-configured global Registry | | dispatcher | Pre-configured global Dispatcher | | events | Factory function for the global system |

Upgrading from 4.x

These changes since 4.5.2 need a change in code, commands or files that use this package. The changelog lists the changes in every package.

  • The default export (the global events factory) is removed from the package root and from @eserstack/events/events. Use the namespace import:

    // Before
    import events from "@eserstack/events";
    // After
    import * as events from "@eserstack/events";
    
    events.events; // the factory that was the default export

🔗 For further details, visit the eserstack repository.