--- title: DeviceProximityEvent slug: Web/API/DeviceProximityEvent translation_of: Web/API/DeviceProximityEvent ---
{{APIRef("Proximity Events")}}{{SeeCompatTable}}
DeviceProximityEvent
接口利用设备的近距离感应器提供有关邻近物品的距离信息。
window.addEventListener('deviceproximity', function(event) {
console.log("value: " + event.value, "max: " + event.max, "min: " + event.min
);
});
Specification | Status | Comment |
---|---|---|
{{ SpecName('Proximity Events', '', 'Proximity Events') }} | {{ Spec2('Proximity Events') }} | Initial specification |