The XRInputSourceEvent()
constructor creates and returns a new XRInputSourceEvent
object describing an event (state change) which has occurred on a WebXR user input device represented by an XRInputSource
.
The XRInputSourceEvent()
constructor creates and returns a new XRInputSourceEvent
object describing an event (state change) which has occurred on a WebXR user input device represented by an XRInputSource
.
js
new XRInputSourceEvent(type, options)
type
A string with the name of the event. It is case-sensitive and browsers set it to select
, selectend
, selectstart
, squeeze
, squeezeend
, squeezestart
.
options
An object that, in addition of the properties defined in Event()
, can have the following properties:
frame
An XRFrame
object representing the event frame during which the event took place. This event is not associated with the animation process, and has no viewer information contained within it.
inputSource
An XRInputSource
object representing the input device from which the event is being sent.
A new XRInputSourceEvent
object representing the event described by the given type
and eventInitDict
.
This example creates a new select
event and sends it to the XRSession
.
js
let event = new XRInputSourceEvent("select", { frame: eventFrame, inputSource: source, }); if (event) { xrSession.dispatchEvent(event); }
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
XRInputSourceEvent |
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/XRInputSourceEvent/XRInputSourceEvent