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

@ekaone/telepath

v0.0.1

Published

Message passing library for Node.js and the browser.

Readme

@ekaone/telepath

Typed cross-context message bus for browser environments.

Designed for horizontal communication across tabs, windows, iframes, and workers instead of within a single runtime.

Tab A  ──telepath──  Tab B
             │
         Web Worker

Install

npm install @ekaone/telepath

// or with pnpm

pnpm add @ekaone/telepath

Quick Start

import { createChannel } from "@ekaone/telepath"

type AppEvents = {
  "user:logout": { reason: string }
  "cart:update": { items: number }
}

const ch = createChannel<AppEvents>("my-app")

// subscribe
ch.on("user:logout", (payload) => {
  console.log("logged out:", payload.reason)
})

// emit — typed, typos caught at compile time
ch.emit("user:logout", { reason: "session-expired" })

// teardown
ch.close()

API

createChannel<TMap>(name, options?)

Creates a named channel. All same-origin contexts using the same name share the channel.

// strict — full type safety (recommended)
const ch = createChannel<AppEvents>("my-app")

// flexible — no schema, payload is unknown
const ch = createChannel("my-app")

Options

| Option | Type | Default | Description | |-------------|---------------------------|--------------|--------------------------------------| | transport | "broadcast" \| "memory" | auto-detect | Force a specific transport adapter |

Auto-detection: uses BroadcastChannel if available, falls back to in-memory.


ch.emit(event, payload)

Broadcast a typed event to all subscribers on this channel across all contexts.

ch.emit("cart:update", { items: 3 })

ch.on(event, listener)unsubscribe

Subscribe to a specific event or wildcard pattern. Returns an unsubscribe function.

// exact match
const unsub = ch.on("cart:update", (payload) => {
  console.log(payload.items)
})

// wildcard — receives event name + payload
ch.on("user:*", (event, payload) => {
  console.log(event, payload)
})

// unsubscribe
unsub()

Wildcard patterns

| Pattern | Matches | |------------|----------------------------------| | * | every event | | user:* | user:login, user:logout, … | | cart:* | cart:update, cart:clear, … |


ch.close()

Tear down the channel and release all underlying resources.

ch.close()

Transports

| Adapter | When used | |--------------------|---------------------------------------------| | BroadcastTransport | Browser — crosses tabs, windows, workers | | MemoryTransport | No BroadcastChannel detected, or forced |

Force a transport explicitly:

// always in-memory (useful in tests)
const ch = createChannel("app", { transport: "memory" })

// always BroadcastChannel
const ch = createChannel("app", { transport: "broadcast" })

Testing with Vitest

No DOM setup needed. Use the memory transport:

import { createChannel } from "@ekaone/telepath"
import { describe, expect, it, vi } from "vitest"

type Events = { "ping": { id: number } }

describe("my feature", () => {
  it("receives events", () => {
    const ch = createChannel<Events>("test", { transport: "memory" })
    const listener = vi.fn()

    ch.on("ping", listener)
    ch.emit("ping", { id: 1 })

    expect(listener).toHaveBeenCalledWith({ id: 1 })
    ch.close()
  })
})

Relationship to @ekaone/hermes

| Package | Scope | Transport | |----------------------|-------------------------------|--------------------| | @ekaone/hermes | In-process event bus | In-memory only | | @ekaone/telepath | Cross-context message bus | BroadcastChannel |

They are composable. A createBridge(hermes, telepath) utility is planned for v0.2.0.


Roadmap

v0.1.0createChannel(), typed events, wildcards, BroadcastTransport, MemoryTransport

v0.2.0createBridge(hermes, telepath), leader election, once()

v0.3.0 — Node cross-process adapter, @ekaone/telepath-devtools


Requirements

  • Node ≥ 18
  • Browser with BroadcastChannel support (all modern browsers)

License

MIT © Eka Prasetia

Links


⭐ If this library helps you, please consider giving it a star on GitHub!