Update records list in BBLocalStorage on fetch

Previously, would only update the known messages.
This commit is contained in:
lilia 2014-10-09 20:08:21 -07:00
parent 2288f8adc1
commit 0f4b53c176
3 changed files with 12 additions and 0 deletions

View file

@ -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];