Giter Club home page Giter Club logo

Comments (13)

jeromegn avatar jeromegn commented on May 22, 2024

I'll need more information.

The new collection smart update? Point me to lines of code, a diff or at least a change log entry.

All tests pass using 0.9.10, so this must be a new feature I'm not aware of. Please explain it :)

from backbone.localstorage.

dlferro avatar dlferro commented on May 22, 2024

Sure.

http://backbonejs.org/#Collection-update.

It could be possible that I'm completely misunderstanding the functionality.

from backbone.localstorage.

Krivega avatar Krivega commented on May 22, 2024

I do not have access to commit to the repository, but the latest version of Backbone requires the following changes:

     if (options && options.success)
-      if (Backbone.VERSION === "0.9.10") {
-        options.success(model, resp, options);
-      } else {
-        options.success(resp);
-      }
+      options.success(resp);

from backbone.localstorage.

jeromegn avatar jeromegn commented on May 22, 2024

@Krivega Yes, but some people could still be using 0.9.10... going to leave that for a little while.

from backbone.localstorage.

Krivega avatar Krivega commented on May 22, 2024

Yes, but if use https://github.com/documentcloud/backbone/blob/master/backbone.js (general change in commit jashkenas/backbone@e4c046c )

from backbone.localstorage.

Krivega avatar Krivega commented on May 22, 2024

it would be good for this purpose set a new version of Backbone(0.9.11)

from backbone.localstorage.

jeromegn avatar jeromegn commented on May 22, 2024

@Krivega we don't follow master, we follow the stable releases.

from backbone.localstorage.

dlferro avatar dlferro commented on May 22, 2024

With the official reason of 1.0 will there be any plans to support http://backbonejs.org/#Collection-set to sync LocalStorage?

from backbone.localstorage.

jeromegn avatar jeromegn commented on May 22, 2024

@dlcerva Does it require anything different in the sync method? I don't see it right off the bat.

from backbone.localstorage.

jeromegn avatar jeromegn commented on May 22, 2024

Would you mind writing a test for this? I will, but it might take some time before I get around doing it.

Once I have a failing test, the fix should be easy.

from backbone.localstorage.

marsch avatar marsch commented on May 22, 2024

@jeromegn any progress on this?

from backbone.localstorage.

jwilm avatar jwilm commented on May 22, 2024

@jeromegn weighing in that I too am interested in this. Thanks!

In the meantime, I have extended my local storage collection with a save method. My use case is simplified since all of the models are updated and never deleted from the collection.

Backbone.Collection.extend({
  // localStorage, model, etc
  save: function() {
    this.each( function(model) {
      Backbone.localSync("update", model)
    })
  }
})

I just call it manually after set, but listening for add/change/remove events and proxying to save should work for more complicated use cases. You would of course need to add an optional argument which is a model and sync action to alter behavior.

from backbone.localstorage.

Krivega avatar Krivega commented on May 22, 2024

you really need tests?

from backbone.localstorage.

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.