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

Re: [IndexedDB] Re: [Bug 9769] New: IDBObjectStoreRequest/Sync.put should be split into 3 methods

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 24 May 2010 13:10:32 -0700
Message-ID: <AANLkTil39zB2rZv5XTL1wQc6E5e1Pdc4fvH3BKMLn_CC@mail.gmail.com>
To: Kris Zyp <kris@sitepen.com>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
On Fri, May 21, 2010 at 6:59 PM, Kris Zyp <kris@sitepen.com> wrote:
>> or to use something like
>> put(record, {forbidOverwrite: true}); // don't overwrite
>> put(record, {onlyOverwrite: true}); // must overwrite/update
>> put(record, {}); or put(record); // can do either
>> or some such.
>> However ultimately I feel like this directive will be used often
>> enough that it makes sense to create explicit API for it. The
>> implementation overhead of separate functions is really not that
>> big, and I can't see any usage overhead?
> I am not too concerned about the implementation. But, as we been using
> this API in SSJS, we have been increasingly using a wrapper pattern,
> wrapping low-level stores with additional functionality that exposes
> the same API. Wrappers add functionality such as caching, data change
> notifications, extra validation, and so. The more methods that are
> exposed the more difficult it is wrap stores.

Couldn't you always simply call addOrModify (or whatever we'll end up
calling it)? Given that neither localStorage or WebSQLDatabase
supports 'forbid overwrite' inserts it seems like this should work?

> Don't assume that the API will only be consumed.

Definitely. The API is definitely intended to be consumable by
libraries. In fact, I suspect that will be the case more often than
not. I'm not really sure that I'm following how the proposed API is
library un-friendly?

/ Jonas
Received on Monday, 24 May 2010 20:11:35 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:25 UTC