MagneticFieldSensor Component


Properties

absoluteStrength
  Indicates the absolute strength of the field.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.absoluteStrength

available
  Indicates that there is a magnetic field sensor in the device and it is available.
Data type: boolean
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.available

enabled
  Indicates whether or not the magnetic field sensor is enabled and working.
Data type: boolean
Designer Writable true <magneticfieldsensor name="magneticfieldsensorName" enabled="true">
Code Writeable true magneticfieldsensorName.enabled = true
Code Readable true let variable = magneticfieldsensorName.enabled

maximumRange
  Indicates the maximum range the magnetic sensor can reach.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.maximumRange

xStrength
  Indicates the field's strength in the X-axis.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.xStrength

yStrength
  Indicates the field's strength in the Y-axis.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.yStrength

zStrength
  Indicates the field's strength in the Z-axis.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = magneticfieldsensorName.zStrength

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

id
  The styling id of the the component
Data type: string
Designer Writable true <magneticfieldsensor name="magneticfieldsensorName" 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 <magneticfieldsensor name="magneticfieldsensorName" 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
magneticChanged Triggers when magnetic field has changed, setting the new values in parameters.
magneticfieldsensorName.addEventListener(
    "magneticChanged",
    function (xStrength, yStrength, zStrength, absoluteStrength) {
        //Your code here
    }
)
xStrength number
yStrength number
zStrength number
absoluteStrength number