W3cubDocs

/Web APIs

XRReferenceSpaceEvent: XRReferenceSpaceEvent() constructor

The XRReferenceSpaceEvent() constructor is used to create a new XRReferenceSpaceEvent object, which represents an event regarding the state of a WebXR reference space object, XRReferenceSpace.

Syntax

js

new XRReferenceSpaceEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers always set it to reset.

options

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

referenceSpace

The XRReferenceSpace from which the event originates.

transform

An XRRigidTransform which maps the old coordinate system (from before the changes indicated by this event) to the new coordinate system.

Return value

A new XRReferenceSpaceEvent object, initialized as defined by the input parameters.

Examples

This simple snippet calls the constructor to create a new reference space event of type reset.

js

let refSpaceEvent = new XRReferenceSpaceEvent("reset", {
  referenceSpace: myRefSpace,
  transform: myTransform,
});

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
XRReferenceSpaceEvent 79 79 No No 66 No No 79 No 57 No 11.2

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceEvent/XRReferenceSpaceEvent