iOS 微信版本7.0.12 陀螺仪失效
iOS 微信版本7.0.12 陀螺仪失效
访问链接:https://shellsvp.nn.cagoe.com/test.html
预期表现:不停刷新 deviceorientation 事件回调的 event.beta 以及下方输出 1
测试微信版本7.0.12 实际结果为 只输出了1,没有更新event.beta
微信版本 7.0.11 符合预期
1 回复
function permission () {
if ( typeof( DeviceMotionEvent ) !== "undefined" && typeof( DeviceMotionEvent.requestPermission ) === "function" ) {
// (optional) Do something before API request prompt.
DeviceMotionEvent.requestPermission()
.then( response => {
// (optional) Do something after API prompt dismissed.
if ( response == "granted" ) {
window.addEventListener( "devicemotion", (e) => {
// do something for 'e' here.
})
}
})
.catch( console.error )
} else {
alert( "DeviceMotionEvent is not defined" );
}
}