Drop examples 1 and 2.
--- a/battery/Overview.html Mon Jun 16 14:20:04 2014 +0300
+++ b/battery/Overview.html Mon Jun 16 14:33:37 2014 +0300
@@ -436,7 +436,7 @@
</p>
<h1 class="title p-name" id="title" property="dcterms:title">Battery Status API</h1>
- <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-06-16T08:15:37.000Z" id="w3c-editor-s-draft-16-june-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-06-16">16 June 2014</time></h2>
+ <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2014-06-16T08:31:57.000Z" id="w3c-editor-s-draft-16-june-2014"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2014-06-16">16 June 2014</time></h2>
<dl>
<dt>This version:</dt>
@@ -618,111 +618,6 @@
monitor the battery level and save changes before the battery runs
out to prevent data loss.
</p>
- <p>
- The following example shows how a web-based email client could check
- for new emails every ten seconds without knowledge of the battery
- status:
- </p>
- <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint prettyprinted"><span class="dec"><!DOCTYPE html></span><span class="pln">
-</span><span class="tag"><html></span><span class="pln">
-</span><span class="tag"><head></span><span class="pln">
- </span><span class="tag"><title></span><span class="pln">Email Client</span><span class="tag"></title></span><span class="pln">
- </span><span class="tag"><script></span><span class="pln">
- </span><span class="kwd">var</span><span class="pln"> mail </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- INTERVAL_DEFAULT</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln">
- interval</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">,</span><span class="pln">
- timer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln">
-
- check</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Checking the server for new emails using an interval of '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
- </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">/</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">' seconds.'</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">},</span><span class="pln">
-
- setTimer</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval </span><span class="pun">===</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">!==</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> clearInterval</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">check</span><span class="pun">();</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> interval</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">=</span><span class="pln"> interval</span><span class="pun">;</span><span class="pln">
- </span><span class="pun">}</span><span class="pln">
- </span><span class="pun">};</span><span class="pln">
-
- window</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(!</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">?</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT </span><span class="pun">:</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
- </span><span class="tag"></script></span><span class="pln">
-</span><span class="tag"></head></span><span class="pln">
-</span><span class="tag"><body></body></span><span class="pln">
-</span><span class="tag"></html></span></pre></div>
- <p>
- The script will always check for emails every ten seconds, even if the
- battery level is critically low and the device is not charging.
- This is an example of poor resource management.
- </p>
- <p>
- Using the <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> interface, the web application is, for
- example, able to throttle checking for emails if the device is low on
- battery, stop checking for emails if the battery is critically low and
- resume normal operation when the battery is charging:
- </p>
- <div class="example"><div class="example-title"><span>Example 2</span></div><pre class="example highlight prettyprint prettyprinted"><span class="dec"><!DOCTYPE html></span><span class="pln">
-</span><span class="tag"><html></span><span class="pln">
-</span><span class="tag"><head></span><span class="pln">
- </span><span class="tag"><title></span><span class="pln">Battery-aware Email Client</span><span class="tag"></title></span><span class="pln">
- </span><span class="tag"><script></span><span class="pln">
- </span><span class="kwd">var</span><span class="pln"> mail </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- INTERVAL_BATTERY_LOW</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln">
- INTERVAL_DEFAULT</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln">
- interval</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">,</span><span class="pln">
- timer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln">
-
- check</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Checking the server for new emails using an interval of '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
- </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">/</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">' seconds.'</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">},</span><span class="pln">
-
- setTimer</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval </span><span class="pun">===</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">!==</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> clearInterval</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">check</span><span class="pun">();</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> interval</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">=</span><span class="pln"> interval</span><span class="pun">;</span><span class="pln">
- </span><span class="pun">}</span><span class="pln">
- </span><span class="pun">};</span><span class="pln">
-
- window</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(!</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">?</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT </span><span class="pun">:</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
-
- </span><span class="kwd">function</span><span class="pln"> updateTimer</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">charging</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT</span><span class="pun">);</span><span class="pln">
- console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Battery is charging, checking the server normally.'</span><span class="pun">);</span><span class="pln">
- </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
- </span><span class="pun">}</span><span class="pln">
-
- </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">dischargingTime </span><span class="pun"><</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">30</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">level </span><span class="pun"><</span><span class="pln"> </span><span class="lit">0.1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">INTERVAL_BATTERY_LOW</span><span class="pun">);</span><span class="pln">
- console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'30 minutes remaining or level below 10%, checking the server less frequently.'</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">dischargingTime </span><span class="pun"><</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">level </span><span class="pun"><</span><span class="pln"> </span><span class="lit">0.05</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="kwd">null</span><span class="pun">);</span><span class="pln">
- console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'10 minutes remaining or level below 5%, stop checking the server.'</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">}</span><span class="pln">
- </span><span class="pun">}</span><span class="pln">
-
- navigator</span><span class="pun">.</span><span class="pln">getBattery</span><span class="pun">().</span><span class="pln">then</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'levelchange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- updateTimer</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">});</span><span class="pln">
- battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'dischargingtimechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- updateTimer</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">});</span><span class="pln">
- battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'chargingchange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
- updateTimer</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">);</span><span class="pln">
- </span><span class="pun">});</span><span class="pln">
- </span><span class="pun">});</span><span class="pln">
- </span><span class="tag"></script></span><span class="pln">
-</span><span class="tag"></head></span><span class="pln">
-</span><span class="tag"><body></body></span><span class="pln">
-</span><span class="tag"></html></span></pre></div>
</section>
<section id="conformance" typeof="bibo:Chapter" resource="#conformance" rel="bibo:Chapter"><!--OddPage--><h2 aria-level="1" role="heading" id="h2_conformance"><span class="secno">2. </span>Conformance</h2>
@@ -981,7 +876,7 @@
This trivial example writes the battery level to the console each time
the level changes:
</p>
- <div class="example"><div class="example-title"><span>Example 3</span></div><pre class="example highlight prettyprint prettyprinted"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getBattery</span><span class="pun">().</span><span class="kwd">then</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+ <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint prettyprinted"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getBattery</span><span class="pun">().</span><span class="kwd">then</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
battery</span><span class="pun">.</span><span class="pln">onlevelchange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="pln">level</span><span class="pun">);</span><span class="pln">
</span><span class="pun">};</span><span class="pln">
@@ -990,7 +885,7 @@
Alternatively, the same using the <code>addEventListener()</code>
method:
</p>
- <div class="example"><div class="example-title"><span>Example 4</span></div><pre class="example highlight prettyprint prettyprinted"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getBattery</span><span class="pun">().</span><span class="kwd">then</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+ <div class="example"><div class="example-title"><span>Example 2</span></div><pre class="example highlight prettyprint prettyprinted"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getBattery</span><span class="pun">().</span><span class="kwd">then</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">battery</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'levelchange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="pln">level</span><span class="pun">);</span><span class="pln">
</span><span class="pun">});</span><span class="pln">
@@ -999,7 +894,7 @@
The following example updates the indicators to show the charging
state, level and time remaining in minutes:
</p>
- <div class="example"><div class="example-title"><span>Example 5</span></div><pre class="example highlight prettyprint prettyprinted"><span class="dec"><!DOCTYPE html></span><span class="pln">
+ <div class="example"><div class="example-title"><span>Example 3</span></div><pre class="example highlight prettyprint prettyprinted"><span class="dec"><!DOCTYPE html></span><span class="pln">
</span><span class="tag"><html></span><span class="pln">
</span><span class="tag"><head></span><span class="pln">
</span><span class="tag"><title></span><span class="pln">Battery Status API Example</span><span class="tag"></title></span><span class="pln">
--- a/battery/Overview.src.html Mon Jun 16 14:20:04 2014 +0300
+++ b/battery/Overview.src.html Mon Jun 16 14:33:37 2014 +0300
@@ -91,116 +91,6 @@
monitor the battery level and save changes before the battery runs
out to prevent data loss.
</p>
- <p>
- The following example shows how a web-based email client could check
- for new emails every ten seconds without knowledge of the battery
- status:
- </p>
- <pre class="example highlight">
- <!DOCTYPE html>
- <html>
- <head>
- <title>Email Client</title>
- <script>
- var mail = {
- INTERVAL_DEFAULT: 1000 * 10,
- interval: null,
- timer: 0,
-
- check: function () {
- console.log('Checking the server for new emails using an interval of ' +
- (mail.interval / 1000) + ' seconds.');
- },
-
- setTimer: function (interval) {
- if (interval === mail.interval) { return; }
- if (mail.timer !== 0) { clearInterval(mail.timer); }
- if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); }
- mail.interval = interval;
- }
- };
-
- window.addEventListener('load', function () {
- mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval);
- }, false);
- </script>
- </head>
- <body></body>
- </html>
-
- </pre>
- <p>
- The script will always check for emails every ten seconds, even if the
- battery level is critically low and the device is not charging.
- This is an example of poor resource management.
- </p>
- <p>
- Using the <a>BatteryManager</a> interface, the web application is, for
- example, able to throttle checking for emails if the device is low on
- battery, stop checking for emails if the battery is critically low and
- resume normal operation when the battery is charging:
- </p>
- <pre class="example highlight">
- <!DOCTYPE html>
- <html>
- <head>
- <title>Battery-aware Email Client</title>
- <script>
- var mail = {
- INTERVAL_BATTERY_LOW: 1000 * 60 * 10,
- INTERVAL_DEFAULT: 1000 * 10,
- interval: null,
- timer: 0,
-
- check: function () {
- console.log('Checking the server for new emails using an interval of ' +
- (mail.interval / 1000) + ' seconds.');
- },
-
- setTimer: function (interval) {
- if (interval === mail.interval) { return; }
- if (mail.timer !== 0) { clearInterval(mail.timer); }
- if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); }
- mail.interval = interval;
- }
- };
-
- window.addEventListener('load', function () {
- mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval);
- }, false);
-
- function updateTimer(battery) {
- if (battery.charging) {
- mail.setTimer(mail.INTERVAL_DEFAULT);
- console.log('Battery is charging, checking the server normally.');
- return;
- }
-
- if (battery.dischargingTime < 60 * 30 || battery.level < 0.1) {
- mail.setTimer(mail.INTERVAL_BATTERY_LOW);
- console.log('30 minutes remaining or level below 10%, checking the server less frequently.');
- } else if (battery.dischargingTime < 60 * 10 || battery.level < 0.05) {
- mail.setTimer(null);
- console.log('10 minutes remaining or level below 5%, stop checking the server.');
- }
- }
-
- navigator.getBattery().then(function(battery) {
- battery.addEventListener('levelchange', function() {
- updateTimer(battery);
- });
- battery.addEventListener('dischargingtimechange', function() {
- updateTimer(battery);
- });
- battery.addEventListener('chargingchange', function() {
- updateTimer(battery);
- });
- });
- </script>
- </head>
- <body></body>
- </html>
- </pre>
</section>
<section id="conformance">