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

eventbroker

v0.0.5

Published

Wrapped event emitter to provide levels/namespaces of events

Readme

###About

EventBroker is wrapper of EventEmitter which provides you to have levels/namespaces of messages to listen to.

So imagine few listeners: lets start with NewYork. It is message by now but also namespace or level or whatever you like to call it. In fact some listener like that NewYork:SomeAvenue is also a message but we wrap it like it is namespace.

So if you listen to NewYork:SomeAvenue you will recieve only what goes there and if you have namespace NewYork:SomeAvenue:AvenueNumber it will not be emitted to NewYork:SomeAvenue, but if you listen to NewYork:SomeAvenue:* you will. And if you listen to NewYork:* you will get all the messages emitted to any namespace inside NewYork eg NewYork:SomeAvenue, NewYork:SomeAvenue:AvenueNumber.


###Example

Require it in your main file and create an instance (i'll put it into global)

EventBroker = require "EventBroker"

global.broker = new EventBroker

Then in any other file do something like this

global.broker.on "NewYork", (message) ->
    console.log "Listen to message to the NewYork"

global.broker.on "NewYork:CentralPark", (message) ->
    console.log "Listen to message to the CentralPark in NewYork"

global.broker.on "NewYork:StarbucksOnBroadway", (message) ->
    console.log "Listen to message to the StarbucksOnBroadway in NewYork"

global.broker.on "NewYork:CentralPark:Bench", (message) ->
    console.log "Listen to message to the Bench in CentralPark in NewYork"


global.broker.on "NewYork:*", (namespace, message) ->
    console.log "Listen to message to anyone in NewYork"

global.broker.on "London:*", (namespace, message) ->
    console.log "Listen to message to anyone in London"

global.broker.on "*", (namespace, message) ->
    console.log "Listen to any message in any namespace"

global.broker.any (namespace, message) ->
    console.log "Listen to any message in any namespace"

And then in main file

slavefile = require "./yourAnotherFile"

global.broker.emit "NewYork", "Hello NewYork and everyone in it who listens to me"
global.broker.emit "London", "Hello London and everyone in it who listens to me"
global.broker.emit "NewYork:CentralPark", "Hello guys in Central Park who listens to me"
global.broker.emit "NewYork:CentralPark:Bench", "Hello beautiful girl right there who listens to me"