interface NodeWorkerLike

Minimal shape of a node:worker_threads Worker as used by this host.

Methods

postMessage(value: unknown): void

Posts a structured-clonable message to the worker.

on(
event: "message" | "error" | "exit",
listener: (arg: unknown) => void
): unknown

Registers an event listener ('message' payloads arrive unwrapped; 'exit' receives the numeric exit code).

terminate(): Promise<number>

Terminates the worker; resolves with the exit code.

Usage

import { type NodeWorkerLike } from "runtime/src/index.ts";