安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

XRInputSourceArray 方法 values() 返回 JavaScript iterator that can walk over the list of XRInputSource objects contained in the array, from first to last.

句法

xrInputSourceArray.values();
					

参数

None.

返回值

A JavaScript iterator that can be used to walk through the list of XRInputSource objects in the array, starting with the first entry (at index 0) and proceeding straight through the list.

范例

This example snippet walks through each input and calls the function checkInput() with each returned value.

for (const source of xrSession.inputSources.values()) {
  checkInput(source);
}
					

这里, for...of is used to iterate over the array's contents. Each pass through the loop, source is the next XRInputSource in the list. The loop exits once every input has been delivered to checkInput() .

规范

规范 状态 注释
WebXR 设备 API
The definition of 'XRInputSourceArray' in that specification.
1
工作草案 XRInputSourceArray interface

[1] Iterator-like methods in Information contained in a WebIDL file for information on how an iterable declaration in an interface definition causes entries() , forEach() , keys() ,和 values() methods to be exposed from objects that implement the interface.

浏览器兼容性

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Chrome 79 Edge 79 Firefox No IE No Opera No Safari No WebView Android No Chrome Android 79 Firefox Android No Opera Android No Safari iOS No Samsung Internet Android 11.2

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: