安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
The WebXR Device API interface
XRInputSourcesChangeEvent
is used to represent the
inputsourceschange
event sent to an
XRSession
when the set of available WebXR input controllers changes.
XRInputSourcesChangeEvent()
XRInputSourcesChangeEvent
object configured as indicated by the given
XRInputSourcesChangeEventInit
object. The specified type must be
inputsourceschange
, which is the only event that uses this interface.
添加
只读
XRInputSource
objects, each representing an input device which has been newly connected or enabled for use.
removed
只读
XRInputSource
objects representing the input devices newly connected or enabled for use.
session
只读
XRSession
to which this input source change event is being directed.
While
XRInputSourcesChangeEvent
defines no methods of its own, it inherits methods from its parent interface,
事件
.
inputsourceschange
XRSession
when the set of input devices available to it changes.
The following example shows how to set up an event handler which uses
inputsourceschange
events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame.
xrSession.addEventListener("inputsourceschange", onInputSourcesChange);
function onInputSourcesChange(event) {
for (let input of event.added) {
if (input.targetRayMode == "tracked-pointer") {
loadControllerMesh(input);
}
}
}
You can also add a handler for
inputsourceschange
events by setting the
oninputsourceschange
event handler:
xrSession.oninputsourceschange = onInputSourcesChange;
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRInputSourcesChangeEvent' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
XRInputSourcesChangeEvent
|
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 |
XRInputSourcesChangeEvent()
构造函数
|
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 |
添加
|
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 |
removed
|
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 |
session
|
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 |
完整支持
不支持
XRInputSourcesChangeEvent