W3C home > Mailing lists > Public > public-device-apis@w3.org > January 2014

Re: Network Information API

From: Fernando Jiménez Moreno <ferjmoreno@gmail.com>
Date: Wed, 15 Jan 2014 12:57:47 +0100
Cc: Marcos Caceres <w3c@marcosc.com>, Mats Wichmann <m.wichmann@samsung.com>, "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-Id: <6AF18346-D90F-4855-87AE-E835281A17E7@gmail.com>
To: Francesco Iovine <f.iovine@gmail.com>
Hi Francesco,

On 15/01/2014, at 01:05, Francesco Iovine <f.iovine@gmail.com> wrote:

> Hi Fernando,
> 
> I have read your proposal, I think it's very well written and comprehensive, very useful to me.

Thanks! I'm glad you found it useful.

> What I want to point out here is that, if I didn't miss something, Marcos proposed an alternative API design based on the new NetInfo interface:
> 
> http://lists.w3.org/Archives/Public/public-device-apis/2014Jan/0013.html
> 
> What I have understood is that the new spec proposed by Marcos provides the following objects/properties:
> 
> navigator.netInfo
> navigator.netInfo.connection
> navigator.netInfo.connection.type  // "wifi", "cellular", "disabled"
> navigator.netInfo.onconnectionchange
> 
> I like this new API design mainly because in this way the API can be easily extended by adding properties to the NetInfo object.

I had a brief conversation with Marcos about this. He can probably elaborate more on this and of course correct me if I am wrong, but as far as I can tell, his reason for adding the netInfo interface was, as you mentioned, to make it more future proof to changes, mostly wrt the naming of things, like instead of 'onchange' it could be 'onconnectionchange', so if things change in the API in the future it will be more clear to what the change applies. I didn't have an strong opinion about this so we just left it as 'navigator.connection' for now, but I am open to reconsider this. I actually agree that it might make it more future proof to extensions.

> Also, the new NetInfo object might be useful to distinguish User-Agents implementing the latest spec from User-Agents implementing the specification v1 (2011). Something like:
> 
> if (navigator.netInfo) { /* Upcoming W3C spec */
> }
> else if (navigator.connection) { /* W3C Working Draft 7 June 2011 */
> }
> 

This is also a good point. I wonder how extended is the usage of the v1 of this spec though. If I am not wrong the Android browser and PhoneGap are the only implementors of this API.

Thanks for the feedback.

Cheers,

/ Fernando
Received on Wednesday, 15 January 2014 12:05:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:33:03 UTC