Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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.
new XRReferenceSpaceEvent(type, options)typeA string with the name of the event. It is case-sensitive and browsers always set it to reset.
optionsAn object that, in addition of the properties defined in Event(), can have the following properties:
referenceSpaceThe XRReferenceSpace from which the event originates.
transformAn XRRigidTransform which maps the old coordinate system (from before the changes indicated by this event) to the new coordinate system.
A new XRReferenceSpaceEvent object, initialized as defined by the input parameters.
This simple snippet calls the constructor to create a new reference space event of type reset.
let refSpaceEvent = new XRReferenceSpaceEvent("reset", {
referenceSpace: myRefSpace,
transform: myTransform,
});