Skip to main content

Class: WebXRRuntimeAdapter

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:153

Implements​

Constructors​

Constructor​

new WebXRRuntimeAdapter(options: WebXRRuntimeAdapterOptions): WebXRRuntimeAdapter;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:206

Parameters​

ParameterType
optionsWebXRRuntimeAdapterOptions

Returns​

WebXRRuntimeAdapter

Properties​

PropertyModifierTypeDescriptionDefined in
sessionreadonlySessionFacetSession lifecycle over navigator.xr and the renderer's XR manager.service-framework-three/src/webxr-runtime-adapter.ts:188

Methods​

clearCapabilityOverrides()​

clearCapabilityOverrides(): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:321

Drop every manual override and fall back to the derived capabilities.

Returns​

void


dispose()​

dispose(): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:331

Release everything the adapter holds: the animation loop, both sets of host event listeners, any in-flight end(), the manual overrides and every listener. It does not end the session - the app owns that decision.

Returns​

void


emitFrame()​

emitFrame(timestamp: number, delta: number): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:280

Push one frame to every subscriber. Call this when you own the loop.

Parameters​

ParameterType
timestampnumber
deltanumber

Returns​

void


getCapabilities()​

getCapabilities(): AdapterCapabilities;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:234

Current XR capabilities (may change once a session is established).

Returns​

AdapterCapabilities

Implementation of​

RuntimeAdapter.getCapabilities


getSession()​

getSession(): WebXRSessionLike | null;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:246

The session the renderer is presenting, or null in 2D.

Returns​

WebXRSessionLike | null


onCapabilitiesChange()​

onCapabilitiesChange(listener: CapabilitiesListener): Unsubscribe;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:238

Subscribe to capability changes; returns an unsubscribe handle. Mirrors RuntimeAdapter.onFrame so gating services can react to a session coming online instead of polling RuntimeAdapter.getCapabilities every frame.

Parameters​

ParameterType
listenerCapabilitiesListener

Returns​

Unsubscribe

Implementation of​

RuntimeAdapter.onCapabilitiesChange


onFrame()​

onFrame(listener: FrameListener): Unsubscribe;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:227

Subscribe to per-frame updates; returns an unsubscribe handle.

Parameters​

ParameterType
listenerFrameListener

Returns​

Unsubscribe

Implementation of​

RuntimeAdapter.onFrame


refreshCapabilities()​

refreshCapabilities(): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:291

Re-read the renderer's session and publish any capability change. The adapter does this itself on every session and input-source event; call it directly after the host enables a feature mid-session, or after a host that raises no events changes what it presents.

Returns​

void


setCapabilities()​

setCapabilities(capabilities: Partial<AdapterCapabilities>): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:315

Force capability flags regardless of what the session reports. Overrides are a layer on top of the derived values: they win for as long as they are set, survive every later derivation, and are dropped only by WebXRRuntimeAdapter.clearCapabilityOverrides or WebXRRuntimeAdapter.dispose.

Parameters​

ParameterType
capabilitiesPartial<AdapterCapabilities>

Returns​

void


start()​

start(): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:260

Bind the animation loop, if this adapter was given a host. Each callback becomes one FrameInfo and, where a scheduler was supplied, one renderTick. With no host this does nothing: the app owns the loop and calls WebXRRuntimeAdapter.emitFrame itself.

three.js routes setAnimationLoop through the session's own requestAnimationFrame while presenting, so one call covers both the 2D page and the headset.

Returns​

void


stop()​

stop(): void;

Defined in: service-framework-three/src/webxr-runtime-adapter.ts:270

Release the animation loop. Safe to call when it was never bound.

Returns​

void