2009/dap/system-info battery-status.html,1.60,1.61

Update of /sources/public/2009/dap/system-info
In directory hutz:/tmp/cvs-serv23740

Modified Files:
	battery-status.html 
Log Message:
incorporate Mounir's feedback <http://www.w3.org/mid/4EA696F4.5030901@lamouri.fr>

Index: battery-status.html
===================================================================
RCS file: /sources/public/2009/dap/system-info/battery-status.html,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- battery-status.html	25 Oct 2011 09:56:16 -0000	1.60
+++ battery-status.html	25 Oct 2011 12:10:19 -0000	1.61
@@ -145,11 +145,11 @@
             
             var battery = navigator.battery;
             
-            battery.addEventListener('remainingtimechange', function () {
-              if (battery.remainingTime &lt; 60 * 30) {
+            battery.addEventListener('dischargingtimechange', function () {
+              if (battery.dischargingTime &lt; 60 * 30) {
                 mail.setTimer(mail.INTERVAL_BATTERY_LOW);
                 console.log('30 minutes remaining, checking the server less frequently.');
-              } else if (battery.remainingTime &lt; 60 * 10) {
+              } else if (battery.dischargingTime &lt; 60 * 10) {
                 mail.setTimer(null);
                 console.log('10 minutes remaining, stop checking the server.');
               }
@@ -198,17 +198,18 @@
         <dt>readonly attribute boolean charging</dt>
         <dd>
           Represents if the system's battery is charging. The attribute MUST be
-          set to true if the battery is charging, and set to false otherwise,
-          or if the implementation is unable to report the state, or there is
-          no battery attached to the system.
+          set to true if the battery is charging, and set to false, if the
+          implementation is unable to report the state, or there is no battery
+          attached to the system, or otherwise.
         </dd>
         <dt>readonly attribute double chargingTime</dt>
         <dd>
           Represents the time remaining in seconds until the system's battery
           is fully charged. The attribute MUST be set to 0, if the battery is
-          full or not charging, or if the implementation is unable to report
-          the remaining charging time, or there is no battery attached to the
-          system.
+          full, and to the value positive Infinity if the battery is
+          discharging, the implementation is unable to report the remaining
+          charging time, there is no battery attached to the system, or
+          otherwise.
         </dd>
         <dt>readonly attribute float level</dt>
         <dd>
@@ -218,13 +219,13 @@
           full, the implementation is unable to report the battery's level,
           or there is no battery attached to the system.
         </dd>
-        <dt>readonly attribute double remainingTime</dt>
+        <dt>readonly attribute double dischargingTime</dt>
         <dd>
           Represents the time remaining in seconds until the system's battery
-          is depleted and the system is about to be suspended. The attribute
-          MUST be set to the value positive Infinity, if the implementation is
-          unable to report the time remaining, or there is no battery attached
-          to the system.
+          is completely discharged and the system is about to be suspended. The
+          attribute MUST be set to the value positive Infinity, if the battery
+          is charging, the implementation is unable to report the time
+          remaining, there is no battery attached to the system, or otherwise.
         </dd>
         <dt>attribute Function? onchargingchange</dt>
         <dd>
@@ -235,30 +236,30 @@
         <dt>attribute Function? onlevelchange</dt>
         <dd>
         </dd>
-        <dt>attribute Function? onremainingtimechange</dt>
+        <dt>attribute Function? ondischargingtimechange</dt>
         <dd>
         </dd>
       </dl>
       <p>
         When a <code>Document</code> object is created, <code>charging</code>
         MUST be set to false, <code>chargingTime</code> to 0,
-        <code>level</code> to 1.0 and <code>remainingTime</code> to the value
+        <code>level</code> to 1.0 and <code>dischargingTime</code> to the value
         positive Infinity, if the implementation is unable to report the
         battery's charging state, charging time, level or remaining time
         respectively.
       </p>
       <p>
         When the value of <code>charging</code>, <code>chargingTime</code>,
-        <code>level</code> or <code>remainingTime</code> attribute changes, the
-        <a class="product-ua" href="#ua">user agent</a> MUST fire a simple
+        <code>level</code> or <code>dischargingTime</code> attribute changes,
+        the <a class="product-ua" href="#ua">user agent</a> MUST fire a simple
         event [[!HTML5]], which does not bubble and is not cancelable, named
         <code>chargingchange</code>, <code>chargingtimechange</code>, 
-        <code>levelchange</code> or <code>remainingtimechange</code>
+        <code>levelchange</code> or <code>dischargingtimechange</code>
         respectively at the <a>BatteryManager</a> object.
       </p>
       <div class="issue">
         TODO: The <code>chargingtimechange</code> and
-        <code>remainingtimechange</code> events should not be fired too often,
+        <code>dischargingtimechange</code> events should not be fired too often,
         so they should be rate limited. For example, firing every second is
         probably too often. Otherwise web developers will need to resort to
         event throttling which is inefficient.
@@ -310,15 +311,15 @@
                 document.querySelector('#level').textContent = battery.level;
               };
 
-              battery.onremainingtimechange = function () {
-                document.querySelector('#remainingTime').textContent = battery.remainingTime / 60;
+              battery.ondischargingtimechange = function () {
+                document.querySelector('#dischargingTime').textContent = battery.dischargingTime / 60;
               };
             &lt;/script&gt;
           &lt;/head&gt;
           &lt;body&gt;
             &lt;div id="charging"&gt;(charging state unknown)&lt;/div&gt;
             &lt;div id="level"&gt;(battery level unknown)&lt;/div&gt;
-            &lt;div id="remainingTime"&gt;(remaining time unknown)&lt;/div&gt;
+            &lt;div id="dischargingTime"&gt;(discharging time unknown)&lt;/div&gt;
           &lt;/body&gt;
           &lt;/html&gt;
         </pre>

Received on Tuesday, 25 October 2011 12:10:26 UTC