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

@bloqz/relay

v2.0.2

Published

A package for enabling inter-bloc communication using an event relay system.

Readme

@bloqz/relay

The @bloqz/relay package provides a lightweight, RxJS-powered event bus for enabling communication between different parts of an application. It uses a flexible subscription model and supports TypeScript generics for full type safety.

Core Concepts

  • Relay: An event bus that allows for emitting and listening to events.
  • Topics: Named channels for events (e.g., 'user', 'cart'), allowing for targeted communication.
  • Events: The data payload associated with a topic. All events must be objects and are recommended to have a type property.

Installation

This package is part of the Bloqz monorepo. To use it, add it as a dependency in your package.json:

"dependencies": {
  "@bloqz/relay": "2.0.2"
}

Usage

Creating a Relay

The primary export of this package is the createRelay function.

import { createRelay } from '@bloqz/relay';

// Create a new relay instance
const appRelay = createRelay();

Type Safety

You can define the events available in your relay to get full TypeScript support.

import { createRelay, RelayEventsMap } from '@bloqz/relay';

interface AppEvents extends RelayEventsMap {
  user: { type: 'login'; userId: string } | { type: 'logout' };
  cart: { type: 'add'; productId: string };
}

const appRelay = createRelay<AppEvents>();

// Types are checked here!
appRelay.emit('user', { type: 'login', userId: '123' });

Emitting Events

You can emit an event to a specific topic using the emit method.

appRelay.emit('user', { type: 'login', userId: '123' });
appRelay.emit('notifications', { type: 'new', message: 'Welcome!' });

Listening for Events

You can listen for events on a specific topic or use the wildcard * to listen to all events. The on method returns an unsubscribe function.

Specific Topic

When listening to a specific topic, the handler receives the event object.

const unsubscribe = appRelay.on('user', (event) => {
  console.log(`User event received: ${event.type}`);
});

// To stop listening
unsubscribe();

Wildcard

When listening with *, the handler receives both the topic name and the event object.

const unsubscribe = appRelay.on('*', (topic, event) => {
  console.log(`Event '${event.type}' received on topic '${topic}'`);
});

Disposing the Relay

When a relay is no longer needed, you can dispose of it to complete the underlying event stream and unsubscribe all listeners.

appRelay.dispose();