Skip to main content

Interface: SessionFacet

Defined in: runtime-adapter.ts:128

Optional session lifecycle facet. Present on adapters whose host owns an XR session; absent on hosts that do not (a plain render loop, for instance). Check adapter.session before using it.

Methods

end()

end(): Promise<void>;

Defined in: runtime-adapter.ts:134

Ask the host to end the session. Resolves once the session is gone.

Returns

Promise<void>


getState()

getState(): SessionState;

Defined in: runtime-adapter.ts:130

The current lifecycle state; "none" before anything is requested.

Returns

SessionState


onStateChange()

onStateChange(listener: (state: SessionState) => void): Unsubscribe;

Defined in: runtime-adapter.ts:136

Subscribe to lifecycle transitions; returns an unsubscribe handle.

Parameters

ParameterType
listener(state: SessionState) => void

Returns

Unsubscribe


onVisibilityChange()

onVisibilityChange(listener: (visibility: SessionVisibility) => void): Unsubscribe;

Defined in: runtime-adapter.ts:138

Subscribe to visibility changes; returns an unsubscribe handle.

Parameters

ParameterType
listener(visibility: SessionVisibility) => void

Returns

Unsubscribe


request()

request(mode: SessionMode, options?: SessionRequestOptions): Promise<SessionResult>;

Defined in: runtime-adapter.ts:132

Ask the host for a session. Resolves with the outcome, never rejects.

Parameters

ParameterType
modeSessionMode
options?SessionRequestOptions

Returns

Promise<SessionResult>