--- 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 |
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{ CompatNo() }} | {{ CompatVersionUnknown() }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatNo() }} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatGeckoMobile("15.0") }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatNo() }} |