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

Re: [contacts] Comments on editors draft of Contacts API

From: Robin Berjon <robin@robineko.com>
Date: Thu, 3 Dec 2009 18:41:17 +0100
Cc: <dom@w3.org>, <public-device-apis@w3.org>
Message-Id: <E8F97C9C-9561-45C9-B61F-58D82C4B70BA@robineko.com>
To: <richard.tibbett@orange-ftgroup.com>
Hi Richard,

On Dec 3, 2009, at 16:51 , <richard.tibbett@orange-ftgroup.com> wrote:
> So, in order to not pollute the global namespace, could we keep the
> Constructor pattern but constrain this to our device namespace?
> Something like this:
> 
> var newContact = new navigator.device.contacts.Contact('Pink Unicorn');
> 
> ...rather than reverting to this...
> 
> var newContact = navigator.contacts.add({name: {formatted: 'Pink
> Unicorn'}});

There's another option :)

var newContact = navigator.device.createContact('Orange Unicorn');

and then proceed as you would have with the constructor. It's not a big difference, but not all users are used to the fact that constructors don't have to be in the global namespace.

--
Robin Berjon
  robineko  hired gun, higher standards
  http://robineko.com/
Received on Thursday, 3 December 2009 17:41:53 GMT

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