XRSessionEvent: XRSessionEvent() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The WebXR Device API's XRSessionEvent() constructor creates and returns a new XRSessionEvent object. These objects represent events announcing state changes in an XRSession representing an augmented or virtual reality session.

Syntax

js
new XRSessionEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to end or visibilitychange.

options

An object that, in addition of the properties defined in Event(), can have the following properties:

session

The XRSession to which the event is to be delivered.

Return value

A new XRSessionEvent object representing an object of the specified type and configured as described by the options parameter.

Examples

See XRSessionEvent for example code.

Specifications

Specification
WebXR Device API
# dom-xrsessionevent-xrsessionevent

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
XRSessionEvent() constructor

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support