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

@sometic/events

v1.0.7

Published

Typed event emitters and subscription helpers for Sometic applications.

Readme

@sometic/events

Typed, disposable event emitters for framework-independent Sometic applications.

@sometic/events provides createEventEmitter, a small typed pub/sub surface with on, once, off, emit, listenerCount, and dispose. Subscriptions return disposables from @sometic/core, so cleanup matches the rest of the Sometic lifecycle model. Event maps are TypeScript-first: payload types flow from your EventMap into every handler.

Sometic is portable application behavior, not a visual component library. Features such as stores, auth, forms, and overlays need a shared way to emit domain events without inventing per-framework bus APIs. This package exists so engines and adapters can notify listeners with abortable subscriptions and listener-error hooks, while remaining SSR-safe and free of browser globals at import time.

Standout features include typed EventMap generics, disposable on / once subscriptions, optional AbortSignal unsubscription, onListenerError isolation so one bad handler does not stop the rest, and a clear disposed flag after dispose(). The emitter stays under a tight size budget so it is safe to pull into leaf modules.

In the ecosystem, events sits on @sometic/core and feeds higher layers that need coordination without a full store. Pair it with @sometic/store when state is shared, or with @sometic/accessibility and DOM engines when UI surfaces need typed signals. Product docs start at https://sometic.dev/guide/introduction.

Install

pnpm add @sometic/events
npm install @sometic/events
yarn add @sometic/events

Usage

Typed emitter with disposable subscription:

import { createEventEmitter } from "@sometic/events";

type AppEvents = {
    ready: { id: string };
    error: { code: string; message: string };
};

const emitter = createEventEmitter<AppEvents>({
    onListenerError: (error, eventName) => {
        console.error(eventName, error);
    },
});

const subscription = emitter.on("ready", ({ id }) => {
    console.log("ready", id);
});

emitter.emit("ready", { id: "session-1" });
subscription.dispose();

One-shot listener with AbortSignal:

import { createEventEmitter } from "@sometic/events";

const emitter = createEventEmitter<{ ping: number }>();
const controller = new AbortController();

emitter.once(
    "ping",
    (value) => {
        console.log(value);
    },
    { signal: controller.signal },
);

emitter.emit("ping", 1);
controller.abort();
emitter.dispose();

CDN

Docs: https://sometic.dev/primitives/events.

Simple script

<script src="https://cdn.jsdelivr.net/npm/@sometic/[email protected]/dist/cdn/sometic-events.iife.js"></script>
<script>
    const emitter = SometicEvents.createEventEmitter();
    emitter.emit("ready", { ok: true });
</script>

Module script

<script type="module">
    import { createEventEmitter } from "https://cdn.jsdelivr.net/npm/@sometic/[email protected]/dist/cdn/sometic-events.esm.js";

    const emitter = createEventEmitter();
</script>

Peers / when not to use

Depends on @sometic/core (installed automatically as a dependency). Prefer @sometic/store when you need continuous shared state and selectors rather than fire-and-forget events. Do not use this package as a replacement for native DOM events on form controls; preserve native events at the UI boundary and emit high-level events only for high-level behavior.

Docs

License

MIT