Definition
WebXR Device API defines XRSession
[SecureContext, Exposed=Window] interface XRSession : EventTarget {
// Attributes
readonly attribute XRVisibilityState visibilityState;
readonly attribute float? frameRate;
readonly attribute Float32Array? supportedFrameRates;
[SameObject] readonly attribute XRRenderState renderState;
[SameObject] readonly attribute XRInputSourceArray inputSources;
[SameObject] readonly attribute XRInputSourceArray trackedSources;
readonly attribute FrozenArray<DOMString> enabledFeatures;
readonly attribute boolean isSystemKeyboardSupported;
// Methods
undefined updateRenderState(optional XRRenderStateInit state = {});
Promise<undefined> updateTargetFrameRate(float rate);
[NewObject] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);
unsigned long requestAnimationFrame(XRFrameRequestCallback callback);
undefined cancelAnimationFrame(unsigned long handle);
Promise<undefined> end();
// Events
attribute EventHandler onend;
attribute EventHandler oninputsourceschange;
attribute EventHandler onselect;
attribute EventHandler onselectstart;
attribute EventHandler onselectend;
attribute EventHandler onsqueeze;
attribute EventHandler onsqueezestart;
attribute EventHandler onsqueezeend;
attribute EventHandler onvisibilitychange;
attribute EventHandler onframeratechange;
};
This interface is extended in the following specifications:
- WebXR Anchors Module
partial interface XRSession { readonly attribute FrozenArray<DOMString> persistentAnchors; Promise<XRAnchor> restorePersistentAnchor(DOMString uuid); Promise<undefined> deletePersistentAnchor(DOMString uuid); };
- WebXR Plane Detection Module
partial interface XRSession { Promise<undefined> initiateRoomCapture(); };
- WebXR Augmented Reality Module - Level 1
partial interface XRSession { // Attributes readonly attribute XREnvironmentBlendMode environmentBlendMode; }; partial interface XRSession { // Attributes readonly attribute XRInteractionMode interactionMode; };
- WebXR Depth Sensing Module
partial interface XRSession { readonly attribute XRDepthUsage depthUsage; readonly attribute XRDepthDataFormat depthDataFormat; };
- WebXR DOM Overlays Module
partial interface XRSession { readonly attribute XRDOMOverlayState? domOverlayState; };
- WebXR Hit Test Module
partial interface XRSession { Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options); Promise<XRTransientInputHitTestSource> requestHitTestSourceForTransientInput(XRTransientInputHitTestOptionsInit options); };
- WebXR Lighting Estimation API Level 1
partial interface XRSession { Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {}); readonly attribute XRReflectionFormat preferredReflectionFormat; };
Consolidated IDL (across mixin and partials)
[SecureContext, Exposed=Window] interface XRSession : EventTarget {
// Attributes
readonly attribute XRVisibilityState visibilityState;
readonly attribute float? frameRate;
readonly attribute Float32Array? supportedFrameRates;
[SameObject] readonly attribute XRRenderState renderState;
[SameObject] readonly attribute XRInputSourceArray inputSources;
[SameObject] readonly attribute XRInputSourceArray trackedSources;
readonly attribute FrozenArray<DOMString> enabledFeatures;
readonly attribute boolean isSystemKeyboardSupported;
// Methods
undefined updateRenderState(optional XRRenderStateInit state = {});
Promise<undefined> updateTargetFrameRate(float rate);
[NewObject] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);
unsigned long requestAnimationFrame(XRFrameRequestCallback callback);
undefined cancelAnimationFrame(unsigned long handle);
Promise<undefined> end();
// Events
attribute EventHandler onend;
attribute EventHandler oninputsourceschange;
attribute EventHandler onselect;
attribute EventHandler onselectstart;
attribute EventHandler onselectend;
attribute EventHandler onsqueeze;
attribute EventHandler onsqueezestart;
attribute EventHandler onsqueezeend;
attribute EventHandler onvisibilitychange;
attribute EventHandler onframeratechange;
readonly attribute FrozenArray<DOMString> persistentAnchors;
Promise<XRAnchor> restorePersistentAnchor(DOMString uuid);
Promise<undefined> deletePersistentAnchor(DOMString uuid);
Promise<undefined> initiateRoomCapture();
// Attributes
readonly attribute XREnvironmentBlendMode environmentBlendMode;
// Attributes
readonly attribute XRInteractionMode interactionMode;
readonly attribute XRDepthUsage depthUsage;
readonly attribute XRDepthDataFormat depthDataFormat;
readonly attribute XRDOMOverlayState? domOverlayState;
Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options);
Promise<XRTransientInputHitTestSource> requestHitTestSourceForTransientInput(XRTransientInputHitTestOptionsInit options);
Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {});
readonly attribute XRReflectionFormat preferredReflectionFormat;
};
Methods and attributes that return objects implementing XRSession
Referring IDL interfaces/dictionaries
Referring specifications
- WebXR Anchors Module refers to
XRSession
- WebXR Plane Detection Module refers to
XRSession
- WebXR Augmented Reality Module - Level 1 refers to
XRSession
- WebXR Depth Sensing Module refers to
XRSession
- WebXR DOM Overlays Module refers to
XRSession
- WebXR Hit Test Module refers to
XRSession
- WebXR Lighting Estimation API Level 1 refers to
XRSession
- WebXR Layers API Level 1 refers to
XRSession