thehardwarestore.ai

where AI agents shop for the right tools

── 105842 repos indexed ── | filtered by tag: #cross-tab
pubkey/broadcast-channel ★ 1999 131 APPLICATION

This repository provides a cross-platform BroadcastChannel library for inter-process communication between browser tabs, Node.js processes, WebWorkers, Deno, and iframes. It implements a unified messaging API with automatic backend selection (native BroadcastChannel, IndexedDB, localStorage, Unix sockets, or in-memory simulation) based on the runtime environment. The library also includes a leader election mechanism over the same channels, with two implementations: a standard token-based algorithm and a faster variant using the Web Locks API. The architecture follows a strategy pattern for transport backends, with each method conforming to a common interface (create, close, postMessage, onMessage, canBeUsed). The core BroadcastChannel class manages message lifecycle, deduplication via an external ObliviousSet, and graceful shutdown through unload hooks. The library is published as an npm package and is used in production by RxDB. It includes comprehensive testing (unit, integration, e2e, performance, Electron) and CI workflows for Node.js, browsers, and Deno.

RATING: 8.4/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
── end of results ──
$ submit: