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

eonemitter

v1.0.3

Published

Minimal and type-safe event emitter with optional behavior support.

Readme

Eonemitter

A minimal, fully-typed, and reactive event emitter for TypeScript and JavaScript.

This lightweight utility provides a simple yet powerful mechanism for handling events in a reactive style. It offers a fully type-safe API, supports multiple listeners, and integrates cleanly with observable patterns without any external dependencies.

✅ Features

  • EventEmitter – basic event system for emitting and listening to events
  • BehaviorEventEmitter – like BehaviorSubject, emits the last value to new subscribers
  • ✅ Fully typed and lightweight

📦 Installation

npm install eonemitter

🚀 Quick Start

ES Modules

import { EventEmitter, BehaviorEventEmitter } from 'eonemitter';

// Basic EventEmitter
const emitter = new EventEmitter<string>();

const subscription = emitter.subscribe((value) => {
  console.log(value); // Logs: 'Hello!'
});

emitter.emit('Hello!');
subscription.unsubscribe();

// BehaviorEventEmitter emits the latest value to new subscribers
const behaviorEmitter = new BehaviorEventEmitter<number>();

const subscription2 = behaviorEmitter.subscribe((value) => {
  console.log(value); // Logs: 777 repeatedly
});

setInterval(() => behaviorEmitter.emit(777), 100);
setTimeout(() => subscription2.unsubscribe(), 500);

CommonJS

const { EventEmitter } = require('eonemitter');

const emitter = new EventEmitter<string>();
emitter.subscribe((value) => {
  console.log(value);
});

emitter.emit('Hi from CommonJS!');

📚 API

EventEmitter

EventEmitter - a generic event emitter that allows subscribing to and emitting events of type T. Supports multiple subscribers and provides control over subscription lifecycles.

subscribe(callback: (value: T) => void): ISubscription
// Subscribes to all future events

subscribeOnce(callback: (value: T) => void): ISubscription
// Subscribes to only the next event, then automatically unsubscribes

asObservable(): IObservable<T> 
// Returns a read-only observable interface to this emitter.

hasSubscribers(): boolean
// Returns true if there are any active subscribers.

emit(value: T): void
// Emits a new event to all current subscribers

unsubscribeAll(): void
// Removes all active subscribers

BehaviorEventEmitter

BehaviorEventEmitter - extends EventEmitter by storing the most recent value. New subscribers will immediately receive the last emitted value upon subscribing.

getValue(): T
// Returns the most recently emitted value.

IObservable

IObservable - exposes a interface for subscribing to events

subscribe(callback: (value: T) => void): ISubscription
// Subscribes to all future events.

subscribeOnce(callback: (value: T) => void): ISubscription
// Subscribes to the next emitted event only, then automatically unsubscribes.

ISubscription

ISubscription - represents a subscription to an event stream. Used to manually unsubscribe when needed.

  unsubscribe(): void; 
  // Cancels the subscription.