aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/batterymanager/chargingtime/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/web/api/batterymanager/chargingtime/index.md')
-rw-r--r--files/es/web/api/batterymanager/chargingtime/index.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/files/es/web/api/batterymanager/chargingtime/index.md b/files/es/web/api/batterymanager/chargingtime/index.md
new file mode 100644
index 0000000000..3e01154290
--- /dev/null
+++ b/files/es/web/api/batterymanager/chargingtime/index.md
@@ -0,0 +1,59 @@
+---
+title: BatteryManager.chargingTime
+slug: Web/API/BatteryManager/chargingTime
+translation_of: Web/API/BatteryManager/chargingTime
+browser-compat: api.BatteryManager.chargingTime
+---
+{{deprecated_header}}
+
+{{APIRef("Battery API")}}
+
+Indica la cantidad de tiempo, en segundos, que faltan para que la batería esté completamente cargada.
+
+> **Nota:** Incluso si el tiempo devuelto es exacto al segundo, los navegadores los redondean a un intervalo más alto (típicamente a los 15 minutos más cercanos) por razones de privacidad.
+
+## Sintaxis
+
+```js
+var time = battery.chargingTime;
+```
+
+La variable `time` recibe el tiempo restante en segundos para que la batería
+esté completamente cargada o 0 (cero) si la `battery` ya está completamente cargada.
+Si la batería está descargándose el valor es [`Infinity`](/es/docs/Web/JavaScript/Reference/Global_Objects/Infinity).
+
+## Ejemplo
+
+### Contenido HTML
+
+```html
+<div id="chargingTime">(tiempo de descarga desconocido)</div>
+```
+
+### Contenido JavaScript
+
+```js
+navigator.getBattery().then(function(battery) {
+ var time = battery.chargingTime;
+
+ document.querySelector("#chargingTime").textContent = battery.chargingTime;
+});
+```
+
+### Resultado
+
+{{EmbedLiveSample('', '100%', 30)}}
+
+## Especificaciones
+
+{{Specifications}}
+
+## Compatibilidad con navegadores
+
+{{Compat}}
+
+## Ver también
+
+- {{domxref("BatteryManager")}}
+- {{domxref("Navigator.getBattery")}}
+