这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
DeviceLightEvent
provides web developers with information from photo sensors or similiar detectors about ambient light levels near the device. For example this may be useful to adjust the screen's brightness based on the current ambient light level in order to save energy or provide better readability.
DeviceLightEvent.value
window.addEventListener('devicelight', function(event) {
console.log(event.value);
});
No specification.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DeviceLightEvent
非标
|
Chrome No | Edge ≤18 — 79 |
Firefox
62
Disabled
|
IE No | Opera No | Safari No | WebView Android No | Chrome Android No |
Firefox Android
62
Disabled
|
Opera Android No | Safari iOS No | Samsung Internet Android No |
value
非标
|
Chrome No | Edge 13 — 79 |
Firefox
62
Disabled
|
IE No | Opera No | Safari No | WebView Android No | Chrome Android No |
Firefox Android
62
Disabled
|
Opera Android No | Safari iOS No | Samsung Internet Android No |
完整支持
不支持
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
见实现注意事项。
用户必须明确启用此特征。
DeviceLightEvent