Class XRSessionAbstract

Hierarchy

  • EventTarget
    • XRSession

Implements

Implemented by

Constructors

Properties

inputSources: XRInputSourceArray

Returns a list of this session's XRInputSources, each representing an input device
used to control the camera and/or scene.

renderState: XRRenderState

object which contains options affecting how the imagery is rendered.
This includes things such as the near and far clipping planes

environmentBlendMode: XREnvironmentBlendMode
visibilityState: XRVisibilityState
frameRate?: number
supportedFrameRates?: Float32Array
enabledFeatures?: string[]
isSystemKeyboardSupported: boolean
oninputsourceschange: XRInputSourceChangeEventHandler
onvisibilitychange: XRSessionEventHandler
onframeratechange: XRSessionEventHandler
requestHitTestSource?: ((options: XRHitTestOptionsInit) => undefined | Promise<XRHitTestSource>)
requestHitTestSourceForTransientInput?: ((options: XRTransientInputHitTestOptionsInit) => undefined | Promise<XRTransientInputHitTestSource>)
requestHitTest?: ((ray: XRRay, referenceSpace: XRReferenceSpace) => undefined | Promise<XRHitResult[]>)
domOverlayState?: XRDOMOverlayState

Methods

  • Removes a callback from the animation frame painting callback from
    XRSession's set of animation frame rendering callbacks, given the
    identifying handle returned by a previous call to requestAnimationFrame().

    Parameters

    • id: number

    Returns void

  • Ends the WebXR session. Returns a promise which resolves when the
    session has been shut down.

    Returns Promise<void>

  • Schedules the specified method to be called the next time the user agent
    is working on rendering an animation frame for the WebXR device. Returns an
    integer value which can be used to identify the request for the purposes of
    canceling the callback using cancelAnimationFrame(). This method is comparable
    to the Window.requestAnimationFrame() method.

    Parameters

    Returns number

  • Requests that a new XRReferenceSpace of the specified type be created.
    Returns a promise which resolves with the XRReferenceSpace or
    XRBoundedReferenceSpace which was requested, or throws a NotSupportedError if
    the requested space type isn't supported by the device.

    Parameters

    Returns Promise<XRReferenceSpace | XRBoundedReferenceSpace>

  • Parameters

    Returns Promise<void>

  • Parameters

    • rate: number

    Returns Promise<void>

  • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

    The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

    When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

    When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

    When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

    If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

    The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

    The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

    When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

    When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

    When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

    If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

    The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

    MDN Reference

    Parameters

    Returns void

  • Removes the event listener in target's event listener list with the same type, callback, and options.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • Removes the event listener in target's event listener list with the same type, callback, and options.

    MDN Reference

    Parameters

    Returns void

  • XRSession is extended to contain the initiateRoomCapture method which,
    if supported, will ask the XR Compositor to capture the current room layout.
    It is up to the XRCompositor if this will replace or augment the set of tracked planes.
    The user agent MAY also ignore this call, for instance if it doesn’t support a manual room
    capture more or if it determines that the room is already set up.
    The initiateRoomCapture method MUST only be able to be called once per XRSession.

    Returns Promise<undefined>

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    MDN Reference

    Parameters

    • event: Event

    Returns boolean