Re: Network Information API: new editor draft

Hi Mounir,

excellent, thanks for getting the ball rolling on this one!

On Jan 31, 2012, at 18:08 , Mounir Lamouri wrote:
> FYI, I wrote a new editor draft for the Network Information API based on
> Mozilla's proposal.
> See:

Some notes, in no specific order of relevance:

 Sometimes you say "Web Applications" and sometimes "web applications", and other times "Web applications". I don't have a preference, but you should be consistent.

 You're using ReSpec v2 (which is great, congratulations on living on the bleeding edge ;) but it has a few very small backwards compatibility issues with v1. One of them is that you no longer need to specify the language for the code highlighter (e.g. with class sh_javascript) but rather let the highlighter do its work on its own, using class "highlight".


 You need to define what the document's subdomain is.

 For bandwidth, you specify that the UA "SHOULD" return a bandwidth estimation. Generally, with a SHOULD, you should (ha!) indicate in what cases that recommendation does not apply. If the idea is that sometimes the bandwidth is unknown, then it's not a SHOULD that you want but really a MUST that covers different situations. Also note that the subject of the testable assertion shouldn't be the IDL attribute, but (in this case) the UA. Perhaps something like:

The user agent MUST set the value of the 'bandwidth' attribute to:
    - 0 if the user is currently offline;
    - Infinity if the bandwidth is unknown;
    - an estimation of the current bandwdith in MB/s (Megabytes per seconds) available for communication with the document's subdomain.

 You need to specify which document applies. If I have iframes from multiple origins, this will vary depending on the context.

 I'm not sure that metered is such a good idea (i.e. reliable enough to be useful), but I'll let others chime in on this. Asking the user doesn't strike me as the best idea.

 The same sort of feedback apply to metered's SHOULD as previously.

 If we do keep metered, I wonder if instead of a boolean we ought to have ""/"maybe"/"probably".

 onchange should have a little bit of documentation.

 In your last example, I think that you're polling at load time when the connection is metered rather than when it's not, which is the reverse of what you want! Wouldn't it be simpler (and less bug-prone) to rewrite that example around:

setInterval(function () {
    if (navigator.connection.metered) return;
}, 1000);
function poll () {
    // do whatever

Thanks again!

Robin Berjon - - @robinberjon

Received on Wednesday, 1 February 2012 10:49:21 UTC