Update records list in BBLocalStorage on fetch
Previously, would only update the known messages.
This commit is contained in:
parent
2288f8adc1
commit
0f4b53c176
3 changed files with 12 additions and 0 deletions
|
@ -99,11 +99,15 @@ extend(Backbone.LocalStorage.prototype, {
|
|||
|
||||
// Retrieve a model from `this.data` by id.
|
||||
find: function(model) {
|
||||
var store = this.localStorage().getItem(this.name);
|
||||
this.records = (store && store.split(",")) || [];
|
||||
return this.serializer.deserialize(this.localStorage().getItem(this.name+"-"+model.id));
|
||||
},
|
||||
|
||||
// Return the array of all models currently in storage.
|
||||
findAll: function() {
|
||||
var store = this.localStorage().getItem(this.name);
|
||||
this.records = (store && store.split(",")) || [];
|
||||
var result = [];
|
||||
for (var i = 0, id, data; i < this.records.length; i++) {
|
||||
id = this.records[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue