这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
displayId
只读特性在
Gamepad
interface
返回
VRDisplay.displayId
of the associated
VRDisplay
— the
VRDisplay
that the gamepad is controlling the displayed scene of.
A Gamepad is considered to be associated with a
VRDisplay
if it reports a pose that is in the same space as the
VRDisplay.pose
.
var myDisplayId = gamepadInstance.displayId;
A number representing the associated
VRDisplay.displayId
. If the number is 0, then the gamepad is not associated with a VR display.
window.addEventListener("gamepadconnected", function(e) {
if(!e.gamepad.displayId) {
console.log('Gamepad connected');
} else {
console.log('Gamepad connected, associated with VR display ' + e.gamepad.displayId);
}
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebVR 1.1
The definition of 'displayId' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
displayId
弃用
|
Chrome
? — 80
Disabled
|
Edge 15 |
Firefox
55
|
IE No | Opera ? | Safari No | WebView Android No |
Chrome Android
? — 80
|
Firefox Android 55 | Opera Android ? | Safari iOS No |
Samsung Internet Android
Yes
|
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。