The DeviceProximityEvent provides information about the distance of a nearby physical object using the proximity sensor of a device.
Attributes
-
max
-
Read only. The maximum sensing distance the sensor is able to report, in centimeters.
-
min
-
Read only. The minimum sensing distance the sensor is able to report, in centimeters. Ususally zero.
-
value
-
Read only. The current device proximity, in centimeters.
Examples
window.addEventListener('deviceproximity', function(event) {
console.log("Current = " + event.value + " Max = " + event.max + " Min = " + event.min);
});
Browser compatibility
| Feature |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
| Basic support |
Not supported |
Not supported |
Not supported |
Not supported |
Not supported |
| Feature |
Android |
Chrome for Android |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
| Basic support |
Not supported |
Not supported |
15.0 (15.0) |
Not supported |
Not supported |
Not supported |
Specifications
| Specification |
Status |
Comment |
| Proximity Events |
Working Draft |
Initial specification |
See also