GithubHelp home page GithubHelp logo

Comments (7)

peterbe avatar peterbe commented on July 25, 2024

Might be hard on the removeItem() or clear() but I could actually make good use of this feature since I store both key-value data and then lastly I store a list of all keys. If either of these fail, it would leave my data in "conflict".
Not desperate but it would be impressive a feature.

from localforage.

tofumatt avatar tofumatt commented on July 25, 2024

At this point calls to the public data API are routed through ready(), so this is quite possible provided we had a queue as well... and a way of rolling back changes.

It's likely quite out-of-scope for a library as simple as localForage. I'll leave this open for a bit longer in case someone wants to take a crack at it though.

from localforage.

tofumatt avatar tofumatt commented on July 25, 2024

Right now this seems pretty out-of-scope for localForage. An entire transaction solution would be heavyweight and not in the spirit of the simplistic nature of localForage.

I think I'll close this for now, but a PR would be welcome in the future.

from localforage.

jampy avatar jampy commented on July 25, 2024

sorry, but why is this heavywheight? both WebSQL and IndexedDB support transactions natively AFAIK, so localforage could just use them.

Okay, this won't work with localStorage driver, but even then an ADVANCED_MODE flag or similar (as proposed by someone else) could restrict usage to the other IndexedDB/WebSQL drivers.

from localforage.

tofumatt avatar tofumatt commented on July 25, 2024

As mentioned, I would be open to a pull request but especially as we want version 1.0 to support localStorage, we would need to support transactions for it. Or this would have to be a feature we land in a 2.0, when maybe we won't use localStorage anymore.

from localforage.

ccorcos avatar ccorcos commented on July 25, 2024

Just wanted to chime in with my use-case. When a user is offline, we save database entries in the browser. When the user comes back online, we sync that up with the server. However, since browser windows share state, without transactions, we can end up committing things twice...

from localforage.

shmilyoo avatar shmilyoo commented on July 25, 2024

really need atomic transaction api.
Many scenarios will encounter this situation of read and write conflicts

from localforage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.