W3C home > Mailing lists > Public > public-device-apis@w3.org > April 2011

Re: Calendar API: navigator ?

From: Robin Berjon <robin@berjon.com>
Date: Wed, 20 Apr 2011 17:13:40 +0200
Cc: public-device-apis@w3.org
Message-Id: <D697AEBB-2B96-422A-8780-EBFBC56A2D28@berjon.com>
To: Joćo Eiras <joao.eiras@gmail.com>
Hi Joćo,

thanks a lot for your feedback.

On Apr 20, 2011, at 15:18 , Joćo Eiras wrote:
> Just became aware of the calendar API
> 
>   http://www.w3.org/TR/calendar-api/

It was only released this week, so you aren't late :)

> I have one serious question: why placing the API inside the navigator object ?
> 
> That seems like unneeded indirection and overloading of navigator.
> Navigator is an object with completely different semantics which just
> contains info about the user agent and webpage environment (name,
> version, supported plugins and mime-types).
> 
> I would suggest making calendar global, like window.calendar and that
> way to remove a dependency.

We've had that discussion quite a few times. Essentially it boils down to this: we like to avoid polluting the global namespace, so we tend to avoid putting things on window unless it is absolutely necessary; and more importantly, the geolocation API, which is already widely deployed, has its entry point on navigator. It makes sense to follow in their path since a lot of developers are already familiar with that. Putting those APIs on the same access point makes them clearer. It is not rare that in specifying something we have to forget about the semantics of a name and go with common practice.

In general, if you think about it, all of these APIs (geolocation, calendar, contacts, etc.) are extra services that the user agent (i.e. the navigator) makes available to the page. So maybe it even sort of makes sense semantically :)

-- 
Robin Berjon - http://berjon.com/
Received on Wednesday, 20 April 2011 15:14:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:20 GMT