UNPKG

use-app-events

Version:

Event system for global communication in vanilla JavaScript and React.

21 lines (20 loc) 543 B
import "react"; import "../lib/heap.js"; import "../lib/options.js"; import o from "./api/verifyMessage.js"; import s from "../lib/notifyEventListeners.js"; import "../lib/listenForEvents.js"; let e = null; globalThis != null && globalThis.BroadcastChannel && (e = new BroadcastChannel("use-app-events:channel"), e != null && e.addEventListener && e.addEventListener("message", (a) => { const t = a.data; if (o(t)) { const { eventType: n, payload: i } = t; s(n, i, !1); } })); export { e as broadcastChannel };