指定一个事件监听器来接受 deviceproximity 事件,当设备传感器检测到一个对象越来越接近或远离设备时这些事件就会出现。


window.onuserproximity = funcRef

其中funcRef是在发生 deviceproximity 事件时要调用的函数。这些事件的类型为DeviceProximityEvent


Specification Status Comment
Proximity Sensor
Proximity Events
Working Draft Initial specification


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 (Yes) 未实现 未实现 未实现
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 15.0 (15.0) 未实现 未实现 未实现

See also