@gjsify/message-channel 0.4.43 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @gjsify/message-channel
2
+
3
+ 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.
4
+
5
+ Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ gjsify install @gjsify/message-channel
11
+
12
+ # npm or yarn also work (e.g. adding it to an existing project):
13
+ npm install @gjsify/message-channel
14
+ yarn add @gjsify/message-channel
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { MessageChannel, MessagePort } from '@gjsify/message-channel';
21
+
22
+ const { port1, port2 } = new MessageChannel();
23
+
24
+ port2.onmessage = (event) => {
25
+ console.log('received:', event.data);
26
+ };
27
+
28
+ port1.postMessage({ hello: 'world' });
29
+ // → received: { hello: 'world' }
30
+
31
+ // Explicit start() is only needed when deferring listener attachment
32
+ port2.start();
33
+ port2.close();
34
+ ```
35
+
36
+ ## License
37
+
38
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/message-channel",
3
- "version": "0.4.43",
3
+ "version": "0.5.0",
4
4
  "description": "W3C MessageChannel + MessagePort for GJS — EventTarget-based, transport-pluggable. Same surface backs in-process channels (default), the @gjsify/iframe WebKit bridge, and (future) @gjsify/worker_threads cross-process workers.",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -45,13 +45,13 @@
45
45
  "messageport"
46
46
  ],
47
47
  "devDependencies": {
48
- "@gjsify/cli": "^0.4.43",
49
- "@gjsify/unit": "^0.4.43",
50
- "@types/node": "^25.9.1",
48
+ "@gjsify/cli": "^0.5.0",
49
+ "@gjsify/unit": "^0.5.0",
50
+ "@types/node": "^25.9.2",
51
51
  "typescript": "^6.0.3"
52
52
  },
53
53
  "dependencies": {
54
- "@gjsify/dom-events": "^0.4.43"
54
+ "@gjsify/dom-events": "^0.5.0"
55
55
  },
56
56
  "license": "MIT",
57
57
  "author": "Pascal Garber <pascal@artandcode.studio>",