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

schmidt

v1.0.0

Published

Fast and small event emitter with optionally importable utility functions for more advanced functionality. TS friendly too.

Downloads

4

Readme

Schmidt (event emitter)

Fast, small event emitter with optionally importable utility functions for more advanced functionality. TS friendly too.

Why?

  • Small (280 bytes gzipped)
  • Fast (benchmarked against mitt and eventemitter3)*
  • Bring in "missing" functionality as needed (see usage below)
  • Even better name than mitt, if you know the New Girl reference

Caveat: event listeners are implemented as a singly linked list (this is what gives it a bit better performance). Each time a new event listener is inserted, it's pushed to the head of the list rather than the back. So, that means when event listeners are called, they're called last first. It's a LIFO instead of a FIFO, unlike most event emitters. I think that's acceptable because it's best practice to not be dependent on the order event listeners are called in.

Usage

The basics, which might feel familiar:

import { Schmidt } from 'schmidt';
let eventEmitter = new Schmidt();
eventEmitter.on('foo', console.log); // { luckyNumber: 0.1542 }
eventEmitter.emit('foo', { luckyNumber: Math.random() });

If you want a once method, fret not, because it can be imported optionally:

import { Schmidt } from 'schmidt';
import { once } from 'schmidt/utils/once';
import { awaitEvent } from 'schmidt/utils/awaitEvent';

let eventEmitter = new Schmidt();
once(eventEmitter, 'foo', console.log);
awaitEvent(eventEmitter, 'foo')
  .then(({ luckyNumber }) => console.log(`Your lucky number is ${luckyNumber}))`));
eventEmitter.emit('foo', { luckyNumber: Math.random() });

This is similar architecture to what projects like lodash and RxJS does. This allows you to have a slim core and import only the bits you need. This reduces the amount of unused code that's shipped to the browser.

In TypeScript, you can enumerate the allowed event names easily for a bit more safety.

import { Schmidt } from 'schmidt';
const enum EventNames {
  foo,
  bar,
  baz
}
let eventEmitter = new Schmidt<EventNames>();
// NOTE new Schmidt<'foo' | 'bar'>() or whatever you want works here too
eventEmitter.on(EventNames.foo, console.log);
// [ts] Argument of type '"lulz"' is not assignable to parameter of type 'EventNames'.
eventEmitter.on('lulz', console.log);

Note you can't reliably type the emitted object. It's just the way of the world with event emitters and TypeScript. Unless you want an emitter per event type.

*Note on speed

Performance benchmarking is still a work in-progress. Benchmarking on mitt seems to never work reliably--I don't know why.

schmidt x 3,799,492 ops/sec ±0.75% (88 runs sampled)
mitt x 1,886 ops/sec ±58.97% (7 runs sampled) # this is messed up. I expected it'd be similar to eventemitter3
eventemitter3 x 3,332,177 ops/sec ±0.64% (90 runs sampled)
Fastest is schmidt

So about 15% performance increase, which isn't a big deal at all, but I thought it was cool that a userland data structure could outperform native arrays.