getTemperatureUnit
Start from API_LEVEL
2.1. Please refer to API_LEVEL.
Get the temperature units set by the user.
Type
function getTemperatureUnit(): Result
Parameters
Result
| Type | Description |
|---|---|
number | Temperature units, value reference temperature unit constants |
Constants
Temperature unit constants
| Constant | Description | API_LEVEL |
|---|---|---|
TEMPERATURE_UNIT_CENTIGRADE | Celsius temperature | 2.0 |
TEMPERATURE_UNIT_FAHRENHEIT | Fahrenheit temperature | 2.0 |
Example
import { getTemperatureUnit, TEMPERATURE_UNIT_CENTIGRADE } from '@zos/settings'
const temperatureUnit = getTemperatureUnit()
if (temperatureUnit === TEMPERATURE_UNIT_CENTIGRADE) {
console.log('centigrade')
}