安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
The WebXR Device API's
XRSessionEvent()
constructor creates and returns a new
XRSessionEvent
对象。
These objects represent events announcing state changes in an
XRSession
representing an augmented or virtual reality session.
newXRSessionEvent = new XRSessionEvent(type, eventInitDict);
type
DOMString
indicating which of the events represented by objects of type
XRSessionEvent
this particular object represents. See
事件类型
for a list of the permitted values.
eventInitDict
An object conforming to the
XRSessionEventInit
dictionary which contains values to be applied to the newly-created event object. Permitted values are:
A newly-created
XRSessionEvent
object representing an object of the specfied type and configured as described by the
eventInitDict
参数。
The following events are represented using the
XRSessionEvent
interface, and are permitted values for its
type
特性。
end
visibilitychange
Fired at the session whenever its visibility state changes.
This example creates a listiener that watches for the visibility state of the session to change. It reacts by calling a function
mySessionVisible()
with a Boolean indicating whether or not the session is visible; this function might, for instance, spin up or reconfigure a worker that handles rendering the scene.
xrSession.addEventListener("visibilitystate", e => {
switch(e.session.visibilitystate) {
case "visible":
case "visible-blurred":
mySessionVisible(true);
break;
case "hidden":
mySessionVisible(false);
break;
}
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRSessionEvent() constructor' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
XRSessionEvent()
构造函数
|
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 |
完整支持
不支持
XRSessionEvent
XRSessionEvent()
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSession
XRSpace
XRView
XRViewerPose
XRViewport
XRWebGLLayer