|
|
@ -99,11 +99,15 @@ extend(Backbone.LocalStorage.prototype, {
|
|
|
|
|
|
|
|
|
|
|
|
// Retrieve a model from `this.data` by id.
|
|
|
|
// Retrieve a model from `this.data` by id.
|
|
|
|
find: function(model) {
|
|
|
|
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 this.serializer.deserialize(this.localStorage().getItem(this.name+"-"+model.id));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Return the array of all models currently in storage.
|
|
|
|
// Return the array of all models currently in storage.
|
|
|
|
findAll: function() {
|
|
|
|
findAll: function() {
|
|
|
|
|
|
|
|
var store = this.localStorage().getItem(this.name);
|
|
|
|
|
|
|
|
this.records = (store && store.split(",")) || [];
|
|
|
|
var result = [];
|
|
|
|
var result = [];
|
|
|
|
for (var i = 0, id, data; i < this.records.length; i++) {
|
|
|
|
for (var i = 0, id, data; i < this.records.length; i++) {
|
|
|
|
id = this.records[i];
|
|
|
|
id = this.records[i];
|
|
|
|