distance of a nearby physical object using the proximity sensor of a device
We'll use max
, min
(max-min sensing distance the sensor is able to report, in centimeters) and value
for the current proximity, in centimeters.
window.addEventListener('deviceproximity', function(event) {
const min = event.min;
const max = event.max;
const value = event.value;
...
});