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

XRInputSourceEventInit dictionary's inputSource property is used when calling the XRInputSourceEvent() constructor to specify the XRInputSource from which the newly-created event is being sent.

Of course, as a general rule, you won't need to create XRInputSourceEventInit objects yourself. These events are generated by and sent to you by the WebXR infrastructure.

句法

let xrInputSourceEventInit.inputSource = xrInputSource;
let xrInputSourceEventInit = { inputSource: xrInputSource };
let xrInputSourceEvent = new XRInputSourceEvent(type, { inputSource: xrInputSource });
					

XRInputSource object indicating the source of the newly-created XRInputSourceEvent to be created. The new object's inputSource will be set to this value.

范例

This example creates a new select event and sends it to the XRSession .

let event = new XRInputSourceEvent("select", {
  frame: eventFrame,
  inputSource: source
};
if (event) {
  xrSession.dispatchEvent(event);
}
					

规范

规范 状态 注释
WebXR 设备 API
The definition of 'XRInputSourceEventInit.inputSource' in that specification.
工作草案 初始定义。

浏览器兼容性

No compatibility data found. Please contribute data for "api.XRInputSourceEventInit.inputSource" (depth: 1) to the MDN 兼容性数据存储库 .

元数据

  • 最后修改: