offGyroscopeChange(listener: Function)

版本要求:
BaseKit≥2.3.2@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { offGyroscopeChange } from '@ray-js/ray';

// Promise 调用
try {
  const res = await offGyroscopeChange({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

取消监听陀螺仪数据变化事件。

参数

参数类型必填说明
是

返回值

无

示例代码

import { onGyroscopeChange, startGyroscope, offGyroscopeChange } from '@ray-js/ray'

// 取消监听陀螺仪:先 onGyroscopeChange + startGyroscope 建立监听,再 offGyroscopeChange 取消
onGyroscopeChange(e => console.log(e));
startGyroscope({
  interval: "normal",
  success: () => {},
  fail: error => console.error(error),
});
offGyroscopeChange(
  () => console.log("已取消监听陀螺仪"),
  error => console.error(error)
);