AmbientLightSensor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

环境光传感器 APIAmbientLightSensor 返回一个用于访问 AmbientLightSensorReading 的接口。

实例

AmbientLightSensor.AmbientLightSensor()

创建一个新的 AmbientLightSensor 对象。

属性

AmbientLightSensor.reading

返回一个 AmbientLightSensorReading 接口,包含当前光的亮度级别。

Examples

js
// TBD

规范

Specification
Ambient Light Sensor
# ambient-light-sensor-interface

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
AmbientLightSensor
Experimental
AmbientLightSensor() constructor
Experimental
illuminance
Experimental

Legend

Tip: you can click/tap on a cell for more information.

No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.
Has more compatibility info.