Skip to main content
Version: v3+

Stand

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Standing behavior Sensor.

info

permission code: data:user.hd.stand

Methods​

getCurrent​

Get the current number of hours with standing behavior

getCurrent(): number

getTarget​

Get the number of hours with standing behavior targets

getTarget(): number

onChange​

Register a callback function to listen for changes in the number of hours of standing behavior

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

offChange​

Cancel a callback function to listen for changes in the number of hours of standing behavior

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

Example​

import { Stand } from '@zos/sensor'

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

stand.onChange(callback)

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