Barometer Component


Properties

airPressure
  The atmospheric pressure in hPa (millibar), if the sensor is available and enabled.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = barometerName.airPressure

available
  Specifies whether or not the device has the hardware to support the Barometer component.
Data type: boolean
Designer Writable false
Code Writeable false
Code Readable true let variable = barometerName.available

enabled
  Specifies whether the sensor should generate events. If true, the sensor will generate events. Otherwise, no events are generated.
Data type: boolean
Designer Writable true <barometer name="barometerName" enabled="true">
Code Writeable true barometerName.enabled = true
Code Readable true let variable = barometerName.enabled

refreshTime
  The requested minimum time in milliseconds between changes in readings being reported. Android is not guaranteed to honor the request. Setting this property has no effect on pre-Gingerbread devices.
Data type: number
Designer Writable true <barometer name="barometerName" refreshTime="1000">
Code Writeable true barometerName.refreshTime = 1000
Code Readable true let variable = barometerName.refreshTime

class
  The styling class of the the component
Data type: string
Designer Writable true <barometer name="barometerName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <barometer name="barometerName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <barometer name="barometerName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
airPressureChanged Called when a change is detected in the air pressure (provided in hPa).
barometerName.addEventListener(
    "airPressureChanged",
    function (pressure) {
        //Your code here
    }
)
pressure number