Skip to main content
Version: v2

Stress

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Stress Sensor.

info

permission code: data:user.hd.stress

Methods

getCurrent

Get the current pressure measurement

getCurrent(): Result

Result

PropertyTypeDescriptionAPI_LEVEL
valuenumberStress measurement values2.0
timenumberTime to obtain the measured value2.0

onChange

Register a callback function to listen for stress measurement change events

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

offChange

Cancel a callback function to listen for stress measurement change events

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

Example

import { Stress } from '@zos/sensor'

const stress = new Stress()
const { value } = stress.getCurrent()

const callback = () => {
console.log(stress.getCurrent())
}

stress.onChange(callback)

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