Thermometer Component


Properties

available
  Specifies whether or not the device has the hardware to support the Thermometer component.
Data type: boolean
Designer Writable false
Code Writeable false
Code Readable true let variable = thermometerName.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 <thermometer name="thermometerName" enabled="true">
Code Writeable true thermometerName.enabled = true
Code Readable true let variable = thermometerName.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 <thermometer name="thermometerName" refreshTime="0">
Code Writeable true thermometerName.refreshTime = 0
Code Readable true let variable = thermometerName.refreshTime

temperature
  Returns the temperature in degrees Celsius. The sensor must be enabled and available to return meaningful values.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = thermometerName.temperature

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

id
  The styling id of the the component
Data type: string
Designer Writable true <thermometer name="thermometerName" 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 <thermometer name="thermometerName" 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
temperatureChanged Indicates a change of temperature, provided in degrees Celsius.
thermometerName.addEventListener(
    "temperatureChanged",
    function (temperature) {
        //Your code here
    }
)
temperature number