Comments (13)
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.
Sure.
http://backbonejs.org/#Collection-update.
It could be possible that I'm completely misunderstanding the functionality.
from backbone.localstorage.
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.
@Krivega Yes, but some people could still be using 0.9.10... going to leave that for a little while.
from backbone.localstorage.
Yes, but if use https://github.com/documentcloud/backbone/blob/master/backbone.js (general change in commit jashkenas/backbone@e4c046c )
from backbone.localstorage.
it would be good for this purpose set a new version of Backbone(0.9.11)
from backbone.localstorage.
@Krivega we don't follow master, we follow the stable releases.
from backbone.localstorage.
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.
@dlcerva Does it require anything different in the sync
method? I don't see it right off the bat.
from backbone.localstorage.
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.
@jeromegn any progress on this?
from backbone.localstorage.
@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.
you really need tests?
from backbone.localstorage.
Related Issues (20)
- Regex error on _clear method
- require config localstorage makes 'Load timeout for modules' error HOT 1
- Duplicate values in records when calling create method multiple times HOT 1
- how to fetch collection from localstorage ?? HOT 9
- Rename to BackboneStorage HOT 1
- Multi-page for local data is empty HOT 1
- underscore.js HOT 1
- Signatures for success() and error() not (model, resp, options)
- Doesn't work with Browserify HOT 2
- Maintaining LocalStorage HOT 4
- Remove Unmaintained Description HOT 2
- Wrong path for main in package.json HOT 1
- Disable console.log in LocalStorage HOT 1
- Webpack required to build usable bacbone.localstorage.js file in browser? HOT 4
- Loading Backbone LocalStorage with requirejs returns an error HOT 5
- Models not saving correctly under version 2.0.0 HOT 3
- Unable to get property 'collection' of undefined or null reference when calling sync(); HOT 1
- Bug in "destroy" metod of localStorage.js HOT 2
- Delete a model from local storage HOT 1
- findAll() returns array and breaks model.fetch()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone.localstorage.