Function: serveIsolated()
ts
function serveIsolated<S>(
spec: S,
factory: IsolatedImplementationFactory<S>,
options?: ServeIsolatedOptions,
): {
stop: () => void;
};Defined in: src/batteries/isolation/serve.ts:330
Serve spec in the CURRENT environment, duck-detecting a Web Worker global scope (globalThis.self.postMessage) or a node child_process (globalThis.process.send) — in that order — and building the matching PortLike automatically. This module never imports any node:* builtin, so it is safe to bundle for either target; the detection is a pure globalThis duck check.
Type Parameters
| Type Parameter |
|---|
S extends IsolatedServiceSpec<MethodMap, StreamMap, EventMap> |
Parameters
| Parameter | Type |
|---|---|
spec | S |
factory | IsolatedImplementationFactory<S> |
options? | ServeIsolatedOptions |
Returns
ts
{
stop: () => void;
}| Name | Type | Defined in |
|---|---|---|
stop() | () => void | src/batteries/isolation/serve.ts:334 |
Throws
@nhtio/adk/batteries/isolation!E_ISOLATION_UNSUPPORTED_ENV when neither environment is detected (e.g. called on a plain main-thread browser tab, or in a test with no fake self/ process.send) — use serveIsolatedOverPort directly there instead.