Skip to main content
版本:v3

FatBurning

API_LEVEL 2.0 开始支持,API 兼容性请参考 API_LEVEL

脂肪燃烧传感器。

信息

权限代码: data:user.hd.fat_burning

方法

getCurrent

获取当前燃脂分钟数

getCurrent(): number

getTarget

获取当前燃脂目标分钟数

getTarget(): number

onChange

注册燃脂分钟数变化事件监听回调函数

onChange(callback: () => void): void

offChange

取消燃脂分钟数变化事件监听回调函数

offChange(callback: () => void): void

代码示例

import { FatBurning } from '@zos/sensor'

const fatBurning = new FatBurning()
const current = fatBurning.getCurrent()
const target = fatBurning.getTarget()
const callback = () => {
console.log(fatBurning.getCurrent())
}

fatBurning.onChange(callback)

// When not needed for use
fatBurning.offChange(callback)