Skip to main content

Class: BabylonRuntimeAdapter

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:194

Implements

Constructors

Constructor

new BabylonRuntimeAdapter(options?: BabylonRuntimeAdapterOptions): BabylonRuntimeAdapter;

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:248

Parameters

ParameterType
optionsBabylonRuntimeAdapterOptions

Returns

BabylonRuntimeAdapter

Properties

PropertyModifierTypeDescriptionDefined in
sessionreadonlySessionFacetSession lifecycle over Babylon's experience helper.service-framework-babylon/src/babylon-runtime-adapter.ts:230

Methods

clearCapabilityOverrides()

clearCapabilityOverrides(): void;

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:366

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

Returns

void


dispose()

dispose(): void;

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:377

Release everything the adapter holds: the render loop, every observer it added to Babylon, the session's own listeners, any in-flight end(), the manual overrides and every subscriber. It does not exit XR and it does not dispose the engine - the app owns both decisions.

Returns

void


emitFrame()

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

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:325

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-babylon/src/babylon-runtime-adapter.ts:279

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

Returns

AdapterCapabilities

Implementation of

RuntimeAdapter.getCapabilities


getSession()

getSession(): BabylonXRSessionLike | null;

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

The live XRSession, or null outside XR.

Returns

BabylonXRSessionLike | null


onCapabilitiesChange()

onCapabilitiesChange(listener: CapabilitiesListener): Unsubscribe;

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:283

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-babylon/src/babylon-runtime-adapter.ts:272

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-babylon/src/babylon-runtime-adapter.ts:336

Re-read the experience's session and publish any capability change. The adapter does this itself on every session and input-source signal; call it directly after the host enables a feature mid-session, or where an experience carries no observables to push with.

Returns

void


setCapabilities()

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

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:360

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 BabylonRuntimeAdapter.clearCapabilityOverrides or BabylonRuntimeAdapter.dispose.

Parameters

ParameterType
capabilitiesPartial<AdapterCapabilities>

Returns

void


start()

start(): void;

Defined in: service-framework-babylon/src/babylon-runtime-adapter.ts:305

Bind the render 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 BabylonRuntimeAdapter.emitFrame itself.

Babylon routes runRenderLoop 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-babylon/src/babylon-runtime-adapter.ts:315

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

Returns

void