我的代码在安装了 WebXr 插件的 chrome 中返回 false,我需要在同步调用中检测到函数。
/**
* isXrSupported
*
* @returns {Boolean}
*/
let isXrSupported = () => {
let supported = false;
(async () => {
if('xr' in navigator){
supported = await navigator.xr.isSessionSupported( 'immersive-vr');
}
})()
return supported;
}
isXrSupported();