- From: Mercurial notifier <cvsmail@w3.org>
- Date: Fri, 07 Dec 2012 09:36:12 +0000
- To: public-dap-commits@w3.org
changeset: 304:a37d05e05215 tag: tip user: Anssi Kostiainen <anssi.kostiainen@nokia.com> date: Fri Dec 07 11:36:05 2012 +0200 files: battery/Overview.html description: add testSuiteURI; editorial changes to examples diff -r ad066c908312 -r a37d05e05215 battery/Overview.html --- a/battery/Overview.html Fri Dec 07 11:27:36 2012 +0200 +++ b/battery/Overview.html Fri Dec 07 11:36:05 2012 +0200 @@ -25,6 +25,7 @@ wgURI: "http://www.w3.org/2009/dap/", wgPublicList: "public-device-apis", wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status", + testSuiteURI: "http://w3c-test.org/dap/battery/tests/" }; </script> </head> @@ -371,58 +372,52 @@ This trivial example writes the battery level to the console each time the level changes: </p> - <div class="example"> - <pre class="example sh_javascript"> - navigator.battery.onlevelchange = function () { - console.log(navigator.battery.level); - }; - </pre> - </div> + <pre class="example sh_javascript"> + navigator.battery.onlevelchange = function () { + console.log(navigator.battery.level); + }; + </pre> <p> Alternatively, the same using the <code>addEventListener()</code> method: </p> - <div class="example"> - <pre class="example sh_javascript"> - navigator.battery.addEventListener('levelchange', function () { - console.log(navigator.battery.level); - }, false); - </pre> - </div> + <pre class="example sh_javascript"> + navigator.battery.addEventListener('levelchange', function () { + console.log(navigator.battery.level); + }, false); + </pre> <p> The following example updates the indicators to show the charging state, level and time remaining in minutes: </p> - <div class="example"> - <pre class="example sh_javascript"> - <!DOCTYPE html> - <html> - <head> - <title>Battery Status API Example</title> - <script> - var battery = navigator.battery; - - battery.onchargingchange = function () { - document.querySelector('#charging').textContent = battery.charging ? 'charging' : 'not charging'; - }; + <pre class="example sh_javascript"> + <!DOCTYPE html> + <html> + <head> + <title>Battery Status API Example</title> + <script> + var battery = navigator.battery; + + battery.onchargingchange = function () { + document.querySelector('#charging').textContent = battery.charging ? 'charging' : 'not charging'; + }; - battery.onlevelchange = function () { - document.querySelector('#level').textContent = battery.level; - }; + battery.onlevelchange = function () { + document.querySelector('#level').textContent = battery.level; + }; - battery.ondischargingtimechange = function () { - document.querySelector('#dischargingTime').textContent = battery.dischargingTime / 60; - }; - </script> - </head> - <body> - <div id="charging">(charging state unknown)</div> - <div id="level">(battery level unknown)</div> - <div id="dischargingTime">(discharging time unknown)</div> - </body> - </html> - </pre> - </div> + battery.ondischargingtimechange = function () { + document.querySelector('#dischargingTime').textContent = battery.dischargingTime / 60; + }; + </script> + </head> + <body> + <div id="charging">(charging state unknown)</div> + <div id="level">(battery level unknown)</div> + <div id="dischargingTime">(discharging time unknown)</div> + </body> + </html> + </pre> </section> <section class="appendix"> <h2>Acknowledgements</h2>
Received on Friday, 7 December 2012 09:36:24 UTC