WebXR 设备 API
's
XRSessionEvent
interface describes an event which indicates the change of the state of an
XRSession
.
These events occur, for example, when the session ends or the visibility of its context changes.
XRSessionEvent()
XRSessionEvent
object configured using the specified
XRSessionEventInit
object's values as available.
In addition to properties inherited from its parent interface,
事件
,
XRSessionEvent
provides the folllowing:
While
XRSessionEvent
defines no methods, it inherits methods from its parent interface,
事件
.
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' 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()
构造函数
|
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 |
完整支持
不支持
XRSessionEvent
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSession
XRSpace
XRView
XRViewerPose
XRViewport
XRWebGLLayer