XRReferenceSpaceEvent()

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.

Currently, only the reset event is defined using this type.

Syntax

new XRReferenceSpaceEvent(type, eventInitDict)

Parameters

type

A DOMString indicating the event type which has occurred. Currently, this is always reset.

eventInitDict

An object to configure the event. The properties are:

  • 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 coordiante 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.

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
No
No
No
79
No
No
No
11.2

© 2005–2021 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