aboutsummaryrefslogtreecommitdiff
path: root/files/es/orphaned/web/api/ambient_light_events/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/orphaned/web/api/ambient_light_events/index.html')
-rw-r--r--files/es/orphaned/web/api/ambient_light_events/index.html115
1 files changed, 115 insertions, 0 deletions
diff --git a/files/es/orphaned/web/api/ambient_light_events/index.html b/files/es/orphaned/web/api/ambient_light_events/index.html
new file mode 100644
index 0000000000..79f4c1ef65
--- /dev/null
+++ b/files/es/orphaned/web/api/ambient_light_events/index.html
@@ -0,0 +1,115 @@
+---
+title: Luz Ambiental Eventos
+slug: orphaned/Web/API/Ambient_Light_Events
+translation_of: Web/API/Ambient_Light_Events
+original_slug: Web/API/Ambient_Light_Events
+---
+<div>{{DefaultAPISidebar("Ambient Light Events")}}{{SeeCompatTable}}</div>
+
+<p>Los eventos de luz ambiental son una forma práctica de hacer una página web o una aplicación al tanto de cualquier cambio en la intensidad de la luz. Se les permite reaccionar a un cambio de este tipo, por ejemplo, cambiando el contraste de color de la interfaz de usuario (UI) o cambiando la exposición necesaria para tomar una foto.</p>
+
+<h2 id="Eventos_de_luz"><span class="short_text" id="result_box" lang="es"><span>Eventos</span> <span>de luz</span></span></h2>
+
+<p>Cuando el sensor de luz de un dispositivo detecta un cambio en el nivel de luz, notifica al navegador de ese cambio. Cuando el navegador recibe dicha notificación, se dispara un {{domxref ( "DeviceLightEvent")}} evento que proporciona información sobre la intensidad de la luz exacta.</p>
+
+<p>Este evento puede ser capturado en el plano objeto de la ventana mediante el uso de la {{domxref ( "EventTarget.addEventListener", "addEventListener")}} El método (usando el {{event( "devicelight")}} nombre del evento) o adjuntando una controlador de eventos al {{domxref ( "window.ondevicelight")}} propiedad.</p>
+
+<p>Una vez capturado, el objeto de evento da acceso a la intensidad de la luz expresada en lux a través de la {{domxref ( "DeviceLightEvent.value")}} propiedad.</p>
+
+<h2 id="Ejemplo">Ejemplo</h2>
+
+<pre class="brush: js">if ('ondevicelight' in window) {
+ window.addEventListener('devicelight', function(event) {
+ var body = document.querySelector('body');
+ if (event.value &lt; 50) {
+ body.classList.add('darklight');
+ body.classList.remove('brightlight');
+ } else {
+ body.classList.add('brightlight');
+ body.classList.remove('darklight');
+ }
+ });
+} else {
+  console.log('devicelight event not supported');
+}
+</pre>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <td>Especificaciones</td>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentario</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("AmbientLight", "", "Ambient Light Events")}}</td>
+ <td>{{Spec2("AmbientLight")}}</td>
+ <td>definición inicial</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_del_Navegador">Compatibilidad del Navegador</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>{{domxref("DeviceLightEvent")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoDesktop("22.0")}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>{{domxref("DeviceLightEvent")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("15.0")}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] The {{event("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 {{geckoRelease("22.0")}} a desktop implementation for Mac OS X is also available. Support for Windows 7 is in progress (see {{bug(754199)}}).</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{domxref("DeviceLightEvent")}}</li>
+ <li>{{event("devicelight")}}</li>
+</ul>