W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2012

Re: Put request need created flag

From: Joshua Bell <jsbell@chromium.org>
Date: Wed, 14 Nov 2012 09:39:00 -0800
Message-ID: <CAD649j4RUDBnr6CBALP7xnes=Wi+_O34KF06cGTrK5idcmBZMg@mail.gmail.com>
To: Kyaw Tun <kyawtun@yathit.com>
Cc: public-webapps@w3.org
On Wed, Nov 14, 2012 at 8:16 AM, Kyaw Tun <kyawtun@yathit.com> wrote:

> I have hard to understand how to use add method effectively.
>
> On my indexeddb wrapper library development, the wrapper database instance
> dispatches installable event for creating, deleting and updating a record.
> Interested components register and listen to update UI or sync to server.
> That requires differentiating created and updated on put call. On the
> otherhand add method throw Error rather than eventing onerror event when
> confict. So it usage will be very rare.
>
> I wish put method request indicates some flag to differentiate between
> created or updated.
>
> I could forget about put and use cursor directly, but still requires extra
> existance test request.
>

If we were to add this, it would be beneficial to retain the current
default behavior of put(). It allows optimizations in some cases where no
read-back is required.

The sync scenario is interesting, and there's been some (offline)
discussion about an observer API that could, for example, observe a key
range and receive a change list at the end of each transaction. This might
also require knowing if a put() was a "change" or an "add", but such a cost
would be opt-in, and could be avoided e.g. during initial loading of data.
Received on Wednesday, 14 November 2012 17:39:28 GMT

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