Type Alias: Unsubscribe
type Unsubscribe = () => void;
Defined in: service-framework/src/runtime-adapter.ts:29
Runtime adapter contract - the seam between a host runtime and services.
A host runtime is whatever owns the frame loop and the XR session: IWSDK, a three.js render loop, a plain browser page, or a test harness. The adapter is the one object a service depends on to reach it, and it carries three things:
- a per-frame fan-out (
onFrame), - capability flags the service gates on (
getCapabilities,onCapabilitiesChange), and - an optional session facet for XR session lifecycle (
session).
MockRuntimeAdapter implements the same interface, so a service written
against RuntimeAdapter is unit-testable headless with no engine, no WebXR
and no headset.
Decision reversed on 2026-09-03. This file previously said the adapter
"deliberately does NOT re-abstract" sessions, input and rendering, on the
grounds that IWSDK already owns them. That held while every consumer was an
IWSDK app. It stopped holding when a reference client had to request a
session, end a session and read session visibility: with no seam for it, the
client reached past the adapter into the host, which is exactly the coupling
the adapter exists to prevent. Session lifecycle is now an optional facet -
RuntimeAdapter.session - so a host that owns sessions can expose them and a
host that does not can leave the property off. Input and rendering are still
not abstracted here.
Returns
void