Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. XRInputSourceArray

XRInputSourceArray

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

The interfaceXRInputSourceArray represents alive list of WebXR input sources, and is used as the return value of theXRSession propertyinputSources. Each entry is anXRInputSource representing one input device connected to the WebXR system.

In addition to being able to access the input sources in the list using standard array notation (that is, with index numbers inside square brackets), methods are available to allow the use of iterators and theforEach() method is also available.

Instance properties

The following properties are available onXRInputSourceArray objects.

lengthRead onlyExperimental

The number ofXRInputSource objects in the list.

Instance methods

The following methods are available onXRInputSourceArray objects. You may also use the features of theSymbol type.

entries()Experimental

Returns aniterator you can use to walk the list of key/value pairs in the list. Each item returned is an array whose first value is the index and whose second value is theXRInputSource at that index.

forEach()Experimental

Iterates over each item in the list, in order from first to last.

keys()Experimental

A list of the keys corresponding to the entries in the input source list.

values()Experimental

Returns aniterator you can use to go through all the values in the list. Each item is a singleXRInputSource object.

In addition to these methods, you may use array notation to access items in the list by index For example, the snippet of code below calls a functionhandleInput(), passing into it the first item in the input source list, if the list isn't empty.

js
let sources = xrSession.inputSources;if (sources.length > 0) {  handleInput(sources[0]);}

Specifications

Specification
WebXR Device API
# xrinputsourcearray-interface

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp