import { onDeviceMotionChange, offDeviceMotionChange, stopDeviceMotionListening } from '@ray-js/ray'
// 取消方向监听:先注册一个监听,再传入同一个 listener 精确取消。
// 末尾 stopDeviceMotionListening 的 success 回调作为用例完成信号
//(off 会移除监听组,TTT 需要一个明确的回调来判定用例结束)。
const listener = e => console.log(e);
onDeviceMotionChange(listener);
offDeviceMotionChange(listener);
stopDeviceMotionListening({
success: () => console.log("offDeviceMotionChange done"),
fail: error => console.error(error),
});