This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
value property of
DeviceProximityEvent objects provides the current distance between the device and the detected object, in centimeters.
var distance = instanceOfDeviceProximityEvent.value;
A positive number representing a distance in centimeters (cm) between the device's proximity sensor and the detected object.
The definition of 'Proximity Events' in that specification.
|Chrome for Android
|Firefox Mobile (Gecko)
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.