- From: Jonas Sicking <jonas@sicking.cc>
- Date: Tue, 8 Sep 2009 00:54:58 -0700
On Tue, Sep 8, 2009 at 12:00 AM, Aaron Boodman<aa at google.com> wrote: > On Fri, Sep 4, 2009 at 12:02 AM, Chris Jones<cjones at mozilla.com> wrote: >> I propose adding the functions >> >> ?window.localStorage.beginTransaction() >> ?window.localStorage.commitTransaction() >> or >> ?window.beginTransaction() >> ?window.commitTransaction() > > I think this is a good idea! I would modify it to follow the pattern > set by the current SQLDatabase proposal, to have a callback, like > this: > > window.localStorage.transaction(function() { > ?// use local storage here > }); We have discussed similar APIs in the past. Something like a: window.getLocalStorage(function (storage) { ...use storage... }); This is nice because it can be expanded to something like: window.getSharedItems(window.SHARED_ITEM_LOCALSTORAGE | window.SHARED_ITEM_COOKIES, function (...) { ... }); to let you access both cookies and localStorage safely at the same time. However, this requires breaking compatibility with existing syntax, something that seems impossible at this point given that Microsoft has shipped localStorage. I know Hixie has asked them in the past about how they plan to deal with the mutex problem, but I'm not sure if an answer has been received as of yet. / Jonas
Received on Tuesday, 8 September 2009 00:54:58 UTC