W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: [indexeddb] Using WebIDL Dictionary in IDBObjectStore.createIndex for optionalParameters

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 6 Jun 2011 13:58:53 -0700
Message-ID: <BANLkTinAOESFwSeo7QOY60c-92bS_+ZRZg@mail.gmail.com>
To: Israel Hilerio <israelh@microsoft.com>, Cameron McCormack <cam@mcc.id.au>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
On Mon, Jun 6, 2011 at 12:03 PM, Israel Hilerio <israelh@microsoft.com> wrote:
> Have you considered using the WebIDL dictionary definition as a mechanism to define the optional parameters in the IDBDatabase.createObjectStore method?
>
> Advantages at using the dictionary definition on WebIDL for optional parameters:
> . Provides a fixed, ordered set of key-value pairs
> . Removes the need to walk the hierarchy chain to determine if these attributes are available
> . Provides default values for each of its key-value pairs
> . Enables an extensible pattern to add new capabilities in the future
>
> I believe this will change our current method definition to the following:
>
> dictionary IDBOptionalParameters {
>    DOMString? keyPath = null;
>    boolean? autoIncrement = false;
> };
>
> IDBIndex   createIndex (in DOMString name, in DOMString keyPath, in optional IDBOptionalParameters optionalParameters) raises (IDBDatabaseException);

We definitely should do this. The reason we didn't originally was that
WebIDL didn't have dictionaries when the current text was written. In
fact, one of the reasons that WebIDL added dictionaries was to allow
IndexedDB to use them :).

The one outstanding issue that I know about is that we want IndexedDB
to throw if any unknown parameters are specified. I don't know if
WebIDL dictionaries support those yet. Or if it's something that we
can specify in prose.

/ Jonas
Received on Monday, 6 June 2011 20:59:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT