Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The keys() method in the XRInputSourceArray interface returns a JavaScript iterator which can then be used to iterate over the keys used to reference each item in the array of input sources.
None.
A JavaScript iterator that can be used to walk through the keys for each entry in the list of input sources. The values returned by the iterator are the indexes of each entry in the list; that is, the numbers 0, 1, 2, and so forth through the index of the last item in the list.
This example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using.
Here, for...of is used to iterate over each of the keys. For each key, the input is retrieved using the index with array notation: xrSession.inputSources[inputIdx].
| WebXR Device API # xrinputsourcearray |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Mar 11, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.