- From: Anssi Kostiainen via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 08 Jun 2011 11:19:05 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/system-info
In directory hutz:/tmp/cvs-serv18121
Modified Files:
battery-status.html
Log Message:
resolve remaining issues before entering LC; add another example
Index: battery-status.html
===================================================================
RCS file: /sources/public/2009/dap/system-info/battery-status.html,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- battery-status.html 6 Jun 2011 12:48:59 -0000 1.22
+++ battery-status.html 8 Jun 2011 11:19:03 -0000 1.23
@@ -80,7 +80,27 @@
</section>
<section>
- <h2><a>BatteryStatusEvent</a> Interface</h2>
+ <h2>The <a>Battery</a> Interface</h2>
+ <p>
+ The <a>Battery</a> interface is exposed on the
+ <code>Window</code> and <code>WorkerGlobalScope</code> objects.
+ </p>
+ <p>
+ The <code>body</code> element exposes as event handler content
+ attribute the <code>onbatterystatus</code> event handler of the
+ <code>Window</code> object. It also mirrors its event handler IDL
+ attribute.
+ </p>
+ <div class='idl' title='Window implements Battery'></div>
+ <div class='idl' title='WorkerGlobalScope implements Battery'></div>
+ <dl title='[NoInterfaceObject] interface Battery'
+ class='idl'>
+ <dt>attribute Function onbatterystatus</dt>
+ <dd>
+ TODO.
+ </dd>
+ </dl>
+ <h2>The <a>BatteryStatusEvent</a> Interface</h2>
<p>
This interface defines the <a>batterystatus</a>
event type.
@@ -137,24 +157,12 @@
</p>
<ul>
<li>
- <code>isPlugged</code> changes, or
+ <code>isPlugged</code> changes its value, or
</li>
<li>
<code>level</code> varies by a 1% or more
</li>
</ul>
- <p class='issue'>
- TODO: Conditions for event triggering must be testable.
- </p>
- <p>
- The <code>onbatterystatus</code> event handler MUST be supported by
- <code>Window</code> and <code>WorkerGlobalScope</code> objects, as an
- IDL attribute on the <code>Window</code> and
- <code>WorkerGlobalScope</code> objects respectively.
- </p>
- <p class='issue'>
- TODO: Define <code>onbatterystatus</code> event handler in WebIDL.
- </p>
<p>
When an event listener is registered with the event type
<a>batterystatus</a>, then the <a class="product-ua" href="#ua">User
@@ -162,6 +170,7 @@
<a>BatteryStatusEvent</a> event asynchronously as defined in
[[!DOM-LEVEL-3-EVENTS]].
</p>
+ </section>
<section>
<h3 id='event-batterystatus'>The <dfn class='event'>batterystatus</dfn>
@@ -205,7 +214,6 @@
</tr>
</table>
</section>
- </section>
<section class='informative'>
<h2>Examples</h2>
@@ -259,6 +267,33 @@
};
</pre>
</div>
+ <p>
+ The following example updates the indicators to show whether or not
+ the device is plugged in and what is the current battery level using
+ the event handler content attribute <code>onbatterystatus</code>
+ exposed on the <code>body</code> element.
+ </p>
+ <div class='example'>
+ <pre class='example sh_javascript'>
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Battery Status Event Example</title>
+ <script>
+ function update(battery) {
+ document.querySelector('#plugged').textContent =
+ battery.isPlugged ? 'plugged' : 'not plugged';
+ document.querySelector('#level').textContent = battery.level;
+ }
+ </script>
+</head>
+<body onbatterystatus="update(this)">
+<div id="plugged">(plugged state unknown)</div>
+<div id="level">(battery level unknown)</div>
+</body>
+</html>
+ </pre>
+ </div>
</section>
<section class='appendix'>
Received on Wednesday, 8 June 2011 11:19:06 UTC