@nuxt/cli
Version:
Nuxt CLI
16 lines (15 loc) • 538 B
JavaScript
import { f as debug } from "./startup-clock-SyYej6uN.mjs";
import { BroadcastChannel } from "node:worker_threads";
// src/dev/broadcast.ts
/** Listen on the channel called `name`, or return nothing where the runtime cannot open one. */
function openBroadcast(name, onMessage) {
try {
const channel = new BroadcastChannel(name);
channel.unref();
channel.onmessage = (event) => onMessage(event.data);
return channel;
} catch (error) {
debug(`Could not open the \`${name}\` channel:`, error);
}
}
export { openBroadcast as t };