ProximitySensor Component
Properties
available Reports whether or not the device has a proximity sensor.
Data type: boolean |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = proximitysensorName.available |
distance Returns the distance from the object to the device. The sensor must be enabled to return meaningful values.
Data type: number |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = proximitysensorName.distance |
enabled If true, the sensor will generate events. Otherwise, no events are generated.
Data type: boolean |
||
Designer Writable | true |
<proximitysensor name="proximitysensorName" enabled="true"> |
Code Writeable | true |
proximitysensorName.enabled = true |
Code Readable | true |
let variable = proximitysensorName.enabled |
keepRunningWhenOnPause Returns value of keepRunningWhenOnPause.
Data type: boolean |
||
Designer Writable | true |
<proximitysensor name="proximitysensorName" keepRunningWhenOnPause="true"> |
Code Writeable | true |
proximitysensorName.keepRunningWhenOnPause = true |
Code Readable | true |
let variable = proximitysensorName.keepRunningWhenOnPause |
maximumRange Determines a sensor's maximum range. Some proximity sensors return binary values that represent "near" or "far." In this case, the sensor usually reports its maximum range value in the far state and a lesser value in the near state. Typically, the far value is a value > 5 cm, but this can vary from sensor to sensor.
Data type: number |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = proximitysensorName.maximumRange |
class The styling class of the the component
Data type: string |
||
Designer Writable | true |
<proximitysensor name="proximitysensorName" class="Test class"> |
Code Writeable | false | |
Code Readable | false |
id The styling id of the the component
Data type: string |
||
Designer Writable | true |
<proximitysensor name="proximitysensorName" 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 |
<proximitysensor name="proximitysensorName" 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. |
|
Events
Event name | Description | Parameters | ||
---|---|---|---|---|
proximityChanged | Triggered when distance (in cm) of the object to the device changes.proximitysensorName.addEventListener( "proximityChanged", function (distance) { //Your code here } ) |
|