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

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

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 8 Jun 2011 11:52:42 +1200
To: timeless <timeless@gmail.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Israel Hilerio <israelh@microsoft.com>, "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <20110607235242.GD31422@wok.mcc.id.au>
timeless:
> would having a field: "mandatory" which indicates which arguments (or
> feature names) must be supported by the implementation assuage your
> concern?
> 
> createObjectStore("car", { mandatory: ["foreignKeys"], keyPath: "id",
> foreignKeys: [{keyPath: "brand", objectStore: "car-brands"}]);

Certainly that would work for this case, and I kind of like it.

I feel like there would be instances where you would need this fail-if-
property-not-specified behaviour and others where would don’t need it,
hence we needn’t require all unrecognised properties to cause the call
to fail.  If we agree with that sentiment, then I think something like
the above is the way to go.  A question would be whether we want to have
some IDL-level support for JS objects specifying properties that need to
be recognised for the call to succeed, or whether it’s OK for individual
specifications like IndexedDB to define their own, like

  dictionary ObjectStoreCreationOptions {
    sequence<DOMString> mandatory;
    DOMString keyPath;
    // ...
  };

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Tuesday, 7 June 2011 23:53:24 GMT

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