W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [IndexedDB] Numeric constants vs enumerated strings

From: Joshua Bell <jsbell@chromium.org>
Date: Wed, 22 Feb 2012 09:02:56 -0800
Message-ID: <CAD649j4xoPqxWTuZZxzpEWCgkOv+-bHLVOm5uvw+DoULBZbs_Q@mail.gmail.com>
To: "public-webapps@w3.org" <public-webapps@w3.org>
On Wed, Feb 22, 2012 at 4:57 AM, Odin HÝrthe Omdal <odinho@opera.com> wrote:

> I propose that we change the numeric constants to enumerated strings in
> the IndexedDB spec.
>
> Reasoning is echoing the reasoning that came up for WebRTC:
> <http://lists.w3.org/Archives/**Public/public-script-coord/**
> 2012JanMar/0166.html<http://lists.w3.org/Archives/Public/public-script-coord/2012JanMar/0166.html>
> >
>
...

>
> So. What do you think? :-)


I don't have strong feelings about this proposal either way. Ignoring the
*Sync APIs, this would involve changing:

Methods:
IDBDatabase.transaction() - mode
IDBObjectStore.openCursor() - direction
IDBIndex.openCursor() - direction
IDBIndex.openKeyCursor() - direction

Attributes (read-only):
IDBRequest.readyState
IDBCursor.direction
IDBTransaction.mode

During a transition period, implementations of the methods could take
either a number or a string. The attributes are not so easy; it would be a
breaking change. Fortunately, those attributes are generally informative
rather than critical for app logic (at least, in the code I've seen), so
the impact is likely to be low. JS authors could check for both values
(e.g. request.readyState === IDBRequest.DONE || request.readyState ===
"done"), just as authors must work around implementation differences today.
So IMHO it's plausible to make this change with little impact.
Received on Wednesday, 22 February 2012 17:03:29 GMT

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