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

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 UTC