Re: What does it all hang off of?

> 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