ProximitySensor Class
The proximity sensor (https://w3c.github.io/proximity/#proximity-sensor-interface): the distance to the closest object, in cm. It reads the DeviceSensorType.Proximity sensor of the device, and needs the proximity permission and the proximity-sensor permissions policy feature.
public sealed class ProximitySensor : Sensor- Inheritance
SensorProximitySensor
Constructors
| Name | Description |
|---|---|
| ProximitySensor(SensorOptions?) | Creates a proximity sensor. Throws a SecurityError DomException when the document is not allowed to use the proximity-sensor feature. |
ProximitySensor(SensorOptions?)
MotionSensors.csCreates a proximity sensor. Throws a SecurityError DomException when the document is not allowed to use the proximity-sensor feature.
public ProximitySensor(SensorOptions? sensorOptions = null)Properties
| Name | Description |
|---|---|
| Distance | Gets the distance to the closest object, in cm, or null. |
| Max | Gets the maximum sensing range, in cm, or null. |
| Near | Gets whether an object is near, or null. |
Distance
MotionSensors.csGets the distance to the closest object, in cm, or null.
public double? Distance { get; }Gets the maximum sensing range, in cm, or null.
public double? Max { get; }Near
MotionSensors.csGets whether an object is near, or null.
public bool? Near { get; }