Getting started with the Ambient Light Sensor


The Ambient Light Sensor API provides developers with the means to determine ambient light levels as detected by the device’s main light detector. This information is available to developers in terms of lux units. If you are building a Progressive Web App and you want to style it differently depending on the light levels in the room, then this could be the feature for you. There are a number of use cases for this feature, such as a web application that provides input for a smart home system to control lighting, a "Kindle" style reading app, or even a web app that calculates settings for a camera with manual controls (aperture, shutter speed, ISO, etc.).


私はChrome Dev Summim 2016でGeneric Sensor APIについて語ったので、Chromeに着陸するのはしばらく時間がかかりました(私はそれがまだフラッグの裏にあると思います)。そしてEdgeに最初に着陸したようです。周囲光センサーは、汎用センサーの上に構築された多くのAPIの1つです。ジャイロや磁力計などがあります。明るさの自動調整などのユースケースを開いたり、暗いモードのテーマに切り替えるようにユーザーに指示するなど、周囲の周囲光レベルに関する情報を得ることができます。 Generic Sensor APIの基本がWebエクスペリエンスにもたらす影響を確認することは、確かに面白いことです。

About Me: Paul Kinlan

I lead the Chrome Developer Relations team at Google.

We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.

Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.