XRLayerEvent()

The XRLayerEvent constructor creates and returns a new XRLayerEvent object. These events relate to a change of state of an XRLayer object.

Syntax

new XRLayerEvent(type, eventInitDict)

Parameters

type

A DOMString indicating which of the events represented by objects of type XRLayerEvent this particular object represents. See Event types for a list of the permitted values.

eventInitDict

An object with the following values:

  • layer: Required. The XRLayer to which the event is to be delivered.

Return value

A newly-created XRLayer object representing an object of the specified type and configured as described by the eventInitDict parameter.

Examples

Creating a new XRLayerEvent

In this example, a new redraw event is created for an XRQuadLayer.

const redrawEvent = new XRLayerEvent("redraw", {
  layer: quadLayer
}):

quadLayer.dispatchEvent();

Specifications

No specification found

No specification data found for api.XRLayerEvent.XRLayerEvent.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

No compatibility data found for api.XRLayerEvent.XRLayerEvent.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.

See also

© 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/XRLayerEvent/XRLayerEvent