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

Re: [IndexedDB] Can IDBTransaction.oncomplete callback be used as active state?

From: Kyle Huey <me@kylehuey.com>
Date: Mon, 19 Nov 2012 07:54:44 -0800
Message-ID: <CAP045ApnVo_NjgR0xroUsXUadnUk7Lb0hQBpiNtuRJO7t9jjsg@mail.gmail.com>
To: Kyaw Tun <kyawtun@yathit.com>
Cc: public-webapps@w3.org
On Sun, Nov 18, 2012 at 7:29 AM, Kyaw Tun <kyawtun@yathit.com> wrote:

> Transaction is active as long as I send request from the IDBRequest
> callback. Is there any other way to prevent committing?
>

No.  If at any point your JavaScript finishes executing there are no
running or pending requests the transaction becomes inactive.


> If there any way to detect transaction active flag?


Not directly.  Attempting to place a new request will fail with a
TransactionInactiveError though.


> I expect IDBTransaction.oncomplete callback can be used to flag inactive
> state, but it is not according to my few test. Transaction is already
> inactive and cannot be use even before receiving oncomplete callback.
>

oncomplete is called after the transaction is committed.  The transition
from active to inactive is what starts committing the transaction, so
oncomplete is far too late to determine that.

- Kyle
Received on Monday, 19 November 2012 15:55:23 GMT

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