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

eveit

v0.0.5

Published

Event-emitter with strong support for type hints

Readme

Eveit => Event Emitter

English | 在线使用 | 更新日志 | Gitee | 留言板

Yes, this is another new js event library, why develop a new one? Let's first look at its advantages

1. features

  1. Powerful ts type support, support event names and parameter type hints for on, emit and other functions
  2. Support static call, new call, inheritance call and binding use
  3. Support to get whether the configuration triggers the last emit event before on
  4. Support head, once, headOnce, off, clear methods (subsequent may consider adding logic such as index, order, but may increase the package size)
  5. Small size (3kb), easy to use, does not depend on any third-party library

2. quickstart

npm i eveit

2.1 Basic use (static call)

import Eveit from 'eveit';
Eveit.on('hello', (v) => {
     console.log('Say ' + v);
});
Eveit.emit('hello', 'Hi');

2.2 ts type support

const e = new Eveit<{
     aa: [string, number, ...any[]],
     bb: [{a: string}],
}>();
e.on('aa', (a1, a2, a3) => {
     // Here it will be inferred that a1 is string, a2 is number, a3 is any
});
e.on('bb', (v, v2) => {
     v.a; // here it will be inferred that v is {a:string}
     // v2 will report an error
});
e.on('cc', () => { // error, cc does not exist
});
e.emit('bb', {a: '1', b: 2}); // attribute b will report an error

2.3 new use

const e = new Eveit();
e.on('hello', (v) => {
     console.log('Say ' + v);
});
e.emit('hello', 'Hi');

2.3 Inheritance use

class Test extends Eveit {
     test () {
         this.on('hello', () => {console.log('hello');});
         this.emit('hello');
     }
}

Generics + inheritance

class Test extends Eveit<{
     aa: [string, number, ...any[]],
     bb: [{a: string}],
}> {
     //...
}

2.4 Binding usage

const a = {};
Eveit.bind(a);
a.on('hello', () => {console.log('hello');});
a.emit('hello');

binding + generics

const a: Eveit<{aa: [string]}> & {
     [prop: string]: any;
} = {
};
Eveit.bind(a);
a.on('aa', (v) => {console.log('hello', v);});
a.emit('aa');

2.5 head,once,off,clear

const e = new Eveit();
e.once('hello', (v) => {console.log('once', v);}); // Only trigger once
e.head('hello', (v) => {console.log('head', v);}); // Put the event in the head
e.headOnce('hello', (v) => {console.log('head', v);}); // combine the above two
const handler = (v) => {console.log(v);}
e.on('hello', handler);
e.off('hello', handler); // Remove a single event listener
e.clear('hello'); // Remove all listeners for the entire event

2.6 Trigger pre-events

global open

Eveit.usePrevEmit = true;
Eveit.emit('hello', 'hi');
Eveit.on('hello', (v) => {console.log(v);});

turn on or off for an object

const e = new Eveit();
e.usePrevEmit = false;
e.emit('hello', 'hi');
e.on('hello', (v) => {console.log(v);}); // will not trigger hello

If you only want to trigger on static calls, you can write like this

Eveit._.usePrevEmit = true;

2.7 onWait

Eveit.onWait('xxx').then();

const e = new Eveit();
e.onWait('xxx').then();