Interface: PortLike
Defined in: src/batteries/isolation/types.ts:313
The minimal message-passing duck the wire protocol (protocol.ts) is built over. A Worker / MessagePort (post = postMessage, onMessage wraps addEventListener('message', ...)) and a Node ChildProcess / process (post = .send, onMessage wraps .on('message', ...)) both satisfy this structurally — WP1 exercises it only against linked in-memory fake ports; WP2/WP3 wire it to the real transports.
Methods
onMessage()
ts
onMessage(fn: (msg: unknown) => void): () => void;Defined in: src/batteries/isolation/types.ts:317
Subscribe to inbound messages. Returns an unsubscribe function.
Parameters
| Parameter | Type |
|---|---|
fn | (msg: unknown) => void |
Returns
() => void
post()
ts
post(msg: unknown): void;Defined in: src/batteries/isolation/types.ts:315
Send a message across the port. Fire-and-forget — no delivery confirmation at this layer.
Parameters
| Parameter | Type |
|---|---|
msg | unknown |
Returns
void