移除罗盘数据变化事件的监听。
<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 = 'direction: ' + res.direction;
ap.offCompassChange(handler);
};
ap.onCompassChange(handler);
</script>