移除重力感应变化事件的监听
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>
<style>
.output{ display:block; max-width: 100%; overflow: auto}
</style>
<h2 class="am-ft-center">晃晃手机试试</h2>
<pre id="J_output" class="output"></pre>
<script>
var output = document.querySelector('#J_output');
var handler = function(res){
output.innerHTML = '\nx: ' + res.x +
'\ny: ' + res.y +
'\nz: ' + res.z;
ap.offAccelerometerChange(handler);
};
ap.onAccelerometerChange(handler);
</script>