Skip to content
1 min read · 260 words

Interface: IsolatedService<S>

Defined in: src/batteries/isolation/host.ts:63

The host-side handle createIsolatedService returns.

Type Parameters

Type Parameter
S extends IsolatedServiceSpec

Properties

PropertyModifierTypeDescriptionDefined in
apireadonlyIsolatedFacade<S>The callable facade — one function per declared method/stream.src/batteries/isolation/host.ts:65
statereadonlyIsolatedServiceStateCurrent lifecycle state.src/batteries/isolation/host.ts:72

Methods

dispose()

ts
dispose(): Promise<void>;

Defined in: src/batteries/isolation/host.ts:75

Send shutdown, wait up to disposeGraceMs for the guest to exit on its own, then force transport.terminate() regardless. Idempotent past the first call.

Returns

Promise<void>


on()

ts
on<K>(channel: K, fn: IsolatedEventListener<S, K>): () => void;

Defined in: src/batteries/isolation/host.ts:68

Subscribe to a declared event channel. Returns an unsubscribe function. Subscriptions survive recycle() (the same underlying map is reused across guest respawns).

Type Parameters

Type Parameter
K extends string

Parameters

ParameterType
channelK
fnIsolatedEventListener<S, K>

Returns

() => void


onCrash()

ts
onCrash(fn: (info: CrashInfo) => void): () => void;

Defined in: src/batteries/isolation/host.ts:70

Subscribe to crash notifications. Returns an unsubscribe function.

Parameters

ParameterType
fn(info: CrashInfo) => void

Returns

() => void


recycle()

ts
recycle(): Promise<void>;

Defined in: src/batteries/isolation/host.ts:78

Terminate the current guest and reconnect through the same transport.connect(). Object identity and .on(...) subscriptions survive; in-flight calls/streams reject with E_ISOLATED_TERMINATED.

Returns

Promise<void>