Giter VIP home page Giter VIP logo

Comments (4)

nilbus avatar nilbus commented on September 27, 2024

We were discussing this here: #12 (comment)

I had also said this, which you have just shown me was an incorrect assumption:

I don't believe we need any mode that uses local storage does not mark records dirty.

Accounting for that, what do you think about having a storageMode option with these options? I'm open to suggestions on the option names. Do they make the behavior obvious?

storageMode: mode # one of: ['dual' (default), 'offline', 'remote-only', 'local-only']

from backbone.dualstorage.

DaveSanders avatar DaveSanders commented on September 27, 2024

I think those work ok. I can't think of a reason why I would use remote-only right now, but it makes sense for completeness. I think the names work fine if their use is documented.

I'm not sure I understand what offline is for?

I'm a little bit confused - would these used in conjunction with the "remote: false" or as a replacement? If a replacement, then I agree this is a better system - providing the decision can be made broadly at the model AND at the individual record save.

Again, I'm dealing with a weird edge case, so I hate to pollute the pool with that. But if there are other uses then making sure to have a local-only for completeness would help my case.

from backbone.dualstorage.

nilbus avatar nilbus commented on September 27, 2024

I will document the options regardless, but I hope to make the option names make sense without having to refer to documentation.

These would replace both the local and remote options. storageMode: 'offline' would be equivalent to how remote: false acts now: it skips the online step, makes the changes locally, and marks the records dirty. Does this table make it clear?

storageMode option online sync ($.ajax) localstorage update mark records dirty current equivalent
dual (default) ✅ if offline default
offline remote option false AND local attribute falsey
local-only remote option false AND local attribute truthy
remote-only remote attribute truthy

from backbone.dualstorage.

DaveSanders avatar DaveSanders commented on September 27, 2024

Yep, that makes sense!

from backbone.dualstorage.

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.