W3C home > Mailing lists > Public > public-device-apis@w3.org > October 2009

Re: What does it all hang off of?

From: Peter-Paul Koch <pp.koch@gmail.com>
Date: Mon, 5 Oct 2009 12:37:18 +0200
Message-ID: <21e4a1280910050337g503f6b54j90d1f4b3c11994bc@mail.gmail.com>
To: Robin Berjon <robin@berjon.com>
Cc: public-device-apis@w3.org
> one issue we have with APIs is also how they are exposed. Say for instance
> that the Contacts API has a basic interface providing access to the rest of
> the functionality called "Contacts". We could:

> 4) Use an object to provide access to all the device APIs:
>
>  var mum = device.contacts.findOne({ nickname: "mum" });
>
> I think the latter is the cleanest option. Specifying one such extensible
> object is trivial, and would be a very short specification.

Definitely. This is the only of the four ways that is actually in line
with how JavaScript works right now. The other three aren't.

This, incidentally, is one of the many problems in BONDI and JIL: they
just don't take the historical growth and use patterns of JavaScript
into account.

> Another option is to hang off of the navigator object just like geolocation
> did — but that seems wrong (I'm not sure why it was chosen there).

Historically the navigator object is the "miscellaneous" category of
JavaScript, where we put all stuff that doesn't directly have to do
with the document or the window. Reasoning from current JavaScript
practices it is the best (or rather, the least bad) place.

I'd say we should define navigator.device and attach all device APIs
to that object, so something like

var mum = navigator.device.contacts['mum']


-------------------------------------------------------------------
ppk, freelance front-end consultant,
agent, and trainer
http://www.quirksmode.org/about/
------------------------------------------------------------------
Received on Monday, 5 October 2009 10:37:47 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:39 UTC