Skip to main content
版本:v3

STEP

创建传感器

const step = hmSensor.createSensor(hmSensor.id.STEP)

console.log(step.current)

step 实例

step: object

属性说明类型
current当前步数number
target目标步数number

注册传感器实例回调事件

step.addEventListener(event, callback: Callback)

CHANGE 事件

event 值

hmSensor.event.CHANGE

Callback

() => void

事件示例

step.addEventListener(hmSensor.event.CHANGE, function () {
console.log('The current step is ' + step.current + '\r\n')
console.log('The step target is ' + step.target + '\r\n')
})