--- title: Window.ondevicelight slug: Web/API/Window/ondevicelight translation_of: Web/API/Window/ondevicelight ---
Especifica um event listener para receber eventos {{event("devicelight")}}. Esses eventos ocorrem quando um dispositivo com sensores de nível de luz detecta uma mudança na intensidade do nível de luz do ambiente.
window.ondevicelight = funcRef
Onde funcRef
é a função a ser chamada quando o evento {{event("devicelight")}} ocorre. Estes eventos são do tipo {{domxref("DeviceLightEvent")}}.
Specificação | Status | Comment |
---|---|---|
{{SpecName('AmbientLight', '#event-handlers', 'Ambient Light Events')}} | {{Spec2('AmbientLight')}} | Initial definition |
{{CompatibilityTable}}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("22.0")}}[1] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatGeckoMobile("15.0")}}[1] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
[1] The {{event("devicelight")}} event is implemented and by preference enabled by default in Firefox Mobile for Android (15.0) and in Firefox OS (B2G). Starting with Gecko 22.0 {{geckoRelease("22.0")}}, a desktop implementation for Mac OS X is also available. Support for Windows 7 is in progress (see {{bug(754199)}}).