2009/dap/netinfo Overview.html,1.3,1.4

Update of /sources/public/2009/dap/netinfo
In directory hutz:/tmp/cvs-serv2177

Modified Files:
	Overview.html 
Log Message:
ready for review

Index: Overview.html
===================================================================
RCS file: /sources/public/2009/dap/netinfo/Overview.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Overview.html	25 May 2011 14:01:17 -0000	1.3
+++ Overview.html	25 May 2011 15:06:32 -0000	1.4
@@ -70,8 +70,14 @@
         information (e.g. connection type) of the device.
 	    </p>
     	<pre class="example sh_javascript">
-    	  // add a class on the root list that matches a specific connection type
-    	  document.documentElement.classList.add("network-" + navigator.connection.type);
+        // add a class on the root list that matches a specific connection type
+        function updateConnectionClass () {
+            var root = document.documentElement,
+                types = "unknown ethernet wifi 2g 3g 4g none".split(" ");
+            for (var i = 0, n = types.length; i &lt; n; i++) root.classList.remove("network-" + types[i])
+            root.classList.add("network-" + navigator.connection.type);
+        }
+        window.onload = window.ononline = window.onoffline = updateConnectionClass;
     	</pre>
     </section>
 
@@ -91,6 +97,7 @@
           </dd>
         </dl>
       </section>
+      
       <section>
 		    <h2>The <a>Connection</a> interface</h2>
 		    <p>
@@ -99,11 +106,18 @@
         <dl title='[NoInterfaceObject] interface Connection' class='idl'>
 	        <dt>readonly attribute DOMString type</dt>
           <dd>
+            <p>
           		Exposes the current connection type. The value returned is one of the following strings,
           		case-sensitively: <code>unknown</code>, <code>ethernet</code>, <code>wifi</code>, <code>2g</code>, 
           		<code>3g</code>, <code>4g</code>, <code>none</code>. Implementers may expose other values,
           		in which case it is RECOMMENDED that they are prefixed with a vendor-specific identifier, e.g.
           		<code>acme-superluminal</code>. Other identifiers may be added in the future.
+            </p>
+            <p class='issue'>
+              The existing implementation, Android, uses integer constants for this (which is a shame since
+              other parts of the Android platform use the more reasonable strings instead). Should we just go with
+              it?
+            </p>
           </dd>
 	        <dt>readonly attribute DOMString networkName</dt>
           <dd>
@@ -120,13 +134,26 @@
 	    </section>
 	  </section>
 	  
-	  <!-- 
-        XXX TODO
-          - add the online event, flag as an issue that we may want something dedicated (flesh out, use HTML simple event)
-          - issue CfC
-    -->
-    
-	  
+	  <section>
+	   <h2>Changes in connection information</h2>
+	   <p>
+	     When changes in the underlying device's connection information occur, the <a>user agent</a> MUST
+	     <a class='externalDFN'>queue a task</a> to <a class='externalDFN'>fire a simple event</a> named
+	     either <code>online</code> or <code>offline</code> depending on the applicable value, as defined
+	     in [[!HTML5]].
+	   </p>
+	   <p>
+	     Note that this may cause the same event (<code>online</code> or <code>offline</code>) to be triggered
+	     multiple times in succession rather than toggling between either value.
+	   </p>
+	   <p class='issue'>
+	     There is discussion about whether this justifies a new event or not. People may have some initialisation
+	     code that runs on <code>online</code> which they don't expect to have to run when one switches from
+	     Wi-Fi to ethernet. By its very nature, such code should be able to run multiple times with no harm, but
+	     it may still be wasteful to do so.
+	   </p>
+	  </section>	
+	    
     <section class='appendix'>
       <h2>Acknowledgements</h2>
       <p>

Received on Wednesday, 25 May 2011 15:06:35 UTC