Licence
MIT
Version
0.13.1
Deps
1
Size
9 kB
Vulns
0
Weekly
1.7K
@gjsify/message-channel
W3C MessageChannel and MessagePort for GJS — EventTarget-based and transport-pluggable. Stock GJS exposes neither; this package provides the full postMessage / start / close / onmessage surface with async (microtask) dispatch. The pluggable transport hook backs the @gjsify/iframe WebKit bridge and future cross-process workers.
Part of the gjsify project — Node.js and Web APIs for GJS (GNOME JavaScript).
Installation
gjsify install @gjsify/message-channel
# npm or yarn also work (e.g. adding it to an existing project):
npm install @gjsify/message-channel
yarn add @gjsify/message-channelUsage
import { MessageChannel, MessagePort } from '@gjsify/message-channel';
const { port1, port2 } = new MessageChannel();
port2.onmessage = (event) => {
console.log('received:', event.data);
};
port1.postMessage({ hello: 'world' });
// → received: { hello: 'world' }
// Explicit start() is only needed when deferring listener attachment
port2.start();
port2.close();License
MIT