aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/web/api/battery_status_api/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-pt/web/api/battery_status_api/index.html')
-rw-r--r--files/pt-pt/web/api/battery_status_api/index.html170
1 files changed, 0 insertions, 170 deletions
diff --git a/files/pt-pt/web/api/battery_status_api/index.html b/files/pt-pt/web/api/battery_status_api/index.html
deleted file mode 100644
index 3b9bf25ab6..0000000000
--- a/files/pt-pt/web/api/battery_status_api/index.html
+++ /dev/null
@@ -1,170 +0,0 @@
----
-title: API do Estado da Bateria
-slug: Web/API/Battery_Status_API
-tags:
- - API
- - API de Bateria
- - API do Estado da Bateria
- - Aplicações
- - Apps
- - Firefox OS
- - Guía
- - Movel
- - Resumo
- - Sinopse
-translation_of: Web/API/Battery_Status_API
-original_slug: Web/API/API_do_Estado_da_Bateria
----
-<div>{{obsolete_header}}</div>
-
-<div>{{DefaultAPISidebar("Battery API")}}</div>
-
-<p>A <em>API do Estado da Bateria</em>, mais conhecida como <strong>API de Bateria</strong>, fornece informação sobre o nível de carga da bateria do sistema e permite-lhe que seja notificado por eventos que são enviados quando o nível da bateria ou o estado de carregamento é alterado. Isto pode ser utilizado para ajustar a utilização de recursos da aplicação para reduzir o consumo de bateria quando a bateria estiver fraca ou para guardar as alterações antes que a bateria acabe para evitar a perda de dados.</p>
-
-<p>The Battery Status API extends {{domxref("window.navigator")}} with a {{domxref("navigator.getBattery()")}} method returning a battery promise, which is resolved in a {{domxref("BatteryManager")}} object providing also some new events you can handle to monitor the battery status.</p>
-
-<h2 id="Exemplo">Exemplo</h2>
-
-<p>In this example, we watch for changes both to the charging status (whether or not we're plugged in and charging) and for changes to the battery level and timing. This is done by listening for the {{event("chargingchange")}}, {{event("levelchange")}}, {{event("chargingtimechange")}}, {{event("dischargingtimechange")}} events.</p>
-
-<pre class="brush: js">navigator.getBattery().then(function(battery) {
- function updateAllBatteryInfo(){
- updateChargeInfo();
- updateLevelInfo();
- updateChargingInfo();
- updateDischargingInfo();
-  }
- updateAllBatteryInfo();
-
- battery.addEventListener('chargingchange', function(){
- updateChargeInfo();
- });
- function updateChargeInfo(){
-  console.log("Battery charging? "
- + (battery.charging ? "Yes" : "No"));
-  }
-
- battery.addEventListener('levelchange', function(){
- updateLevelInfo();
- });
- function updateLevelInfo(){
-  console.log("Battery level: "
- + battery.level * 100 + "%");
-  }
-
- battery.addEventListener('chargingtimechange', function(){
- updateChargingInfo();
- });
- function updateChargingInfo(){
-  console.log("Battery charging time: "
- + battery.chargingTime + " seconds");
-  }
-
- battery.addEventListener('dischargingtimechange', function(){
- updateDischargingInfo();
- });
- function updateDischargingInfo(){
-  console.log("Battery discharging time: "
- + battery.dischargingTime + " seconds");
-  }
-
-});
-</pre>
-
-<p>See also <a class="external" href="http://www.w3.org/TR/battery-status/#examples">the example in the specification</a>.</p>
-
-<h2 id="Especificações">Especificações</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Especificação</th>
- <th scope="col">Estado</th>
- <th scope="col">Comentário</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName("Battery API")}}</td>
- <td>{{Spec2("Battery API")}}</td>
- <td>Initial definition</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilidade_do_navegador">Compatibilidade do 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>Basic support</td>
- <td>{{CompatChrome(39.0)}}</td>
- <td>{{CompatGeckoDesktop("10")}} {{property_prefix("moz")}}<br>
- {{CompatGeckoDesktop("16")}}<sup>[1]</sup><br>
- {{CompatGeckoDesktop("43")}}<sup>[3]</sup><br>
- {{CompatGeckoDesktop("52")}}<sup>[4]</sup></td>
- <td>{{CompatNo}}</td>
- <td>25</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>Android Webview</th>
- <th>Firefox Mobile (Gecko)</th>
- <th>IE Mobile</th>
- <th>Opera Mobile</th>
- <th>Safari Mobile</th>
- <th>Chrome for Android</th>
- </tr>
- <tr>
- <td>Basic support</td>
- <td>{{CompatNo}}</td>
- <td>{{CompatChrome(40.0)}}</td>
- <td>
- <p>{{CompatGeckoMobile("10")}} {{property_prefix("moz")}}<br>
- {{CompatGeckoMobile("16")}}<sup>[1]</sup><br>
- {{CompatGeckoMobile("43")}}<sup>[3]</sup><br>
- {{CompatGeckoMobile("52")}}<sup>[3]</sup></p>
- </td>
- <td>{{CompatNo}}</td>
- <td>25<sup>[2]</sup></td>
- <td>{{CompatNo}}</td>
- <td>{{CompatChrome(42.0)}}<sup>[2]</sup></td>
- </tr>
- </tbody>
-</table>
-</div>
-
-<p>[1] Disabled by default in Firefox 10.0, but can be enabled setting the preference <code>dom.battery.enabled</code> to <code>true</code>. Starting with Firefox 11.0, <code>mozBattery</code> is enabled by default. The Battery API is currently supported on Android, Windows, and Linux with UPower installed. Support for MacOS is available starting with Gecko 18.0 {{geckoRelease("18.0")}}. Firefox also provides support for the deprecated {{domxref("navigator.battery")}}.</p>
-
-<p>[2] Values for {{domxref("BatteryManager.chargingTime")}} and {{domxref("BatteryManager.dischargingTime")}} are always equal to <code>Infinity</code>.</p>
-
-<p>[3] The new promise-based syntax for {{domxref("Navigator.getBattery()")}} is supported from Firefox 43 onwards.</p>
-
-<p>[4] From Firefox 52 onwards, the Battery Status API is only available in chrome/privileged code.</p>
-
-<h2 id="Consultar_também">Consultar também</h2>
-
-<ul>
- <li><a href="/en-US/Apps/Build/gather_and_modify_data/retrieving_battery_status_information">Retrieving battery status information - demo &amp; article</a></li>
- <li><a class="external" href="http://hacks.mozilla.org/2012/02/using-the-battery-api-part-of-webapi/">Hacks blog post - Using the Battery API</a></li>
-</ul>