这篇翻译不完整。请帮忙从英语翻译这篇文章

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

DeviceLightEvent为Web开发人员提供来自光传感器或类似设备附近环境光水平的探测器的信息。 例如,这可以用于基于当前环境光水平调节屏幕的亮度,以便节省电量或提供更好的阅读性。

Properties

DeviceLightEvent.value
The level of the ambient light in lux.

Example

window.addEventListener('devicelight', function(event) {
  console.log(event.value);
});

Specifications

Specification Status Comment
Ambient Light Sensor
Ambient Light Events
Candidate Recommendation Initial specification

Browser compatibility

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!
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 22.0 (22.0) (Mac OS X only) 未实现 未实现 未实现
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 15.0 (15.0) 未实现 未实现 未实现

Gecko-specific notes

The devicelight event is implemented and preference enabled by default in Firefox Mobile for Android (15.0) and in Firefox OS (B2G). Starting with Gecko 22.0 (Firefox 22.0 / Thunderbird 22.0 / SeaMonkey 2.19) a desktop implementation for Mac OS X is also available. Support for Windows 7 is in progress (see bug 754199).

See also

文档标签和贡献者

此页面的贡献者: Fantastic-Chen, mdnwebdocs-bot, fscholz
最后编辑者: Fantastic-Chen,