MCPcopy
hub / github.com/jeromegn/Backbone.localStorage / update

Method update

src/localstorage.js:81–91  ·  view source on GitHub ↗

Update an existing model in LocalStorage * @param {Model} model - The model to update * @returns {Model} The updated model

(model)

Source from the content-addressed store, hash-verified

79 * @returns {Model} The updated model
80 */
81 update(model) {
82 this._setItem(this._itemName(model.id), this.serializer.serialize(model));
83
84 const modelId = model.id.toString();
85
86 if (!contains(this.records, modelId)) {
87 this.records.push(modelId);
88 this.save();
89 }
90 return this.find(model);
91 }
92
93 /** Retrieve a model from local storage by model id
94 * @param {Model} model - The Backbone Model to lookup

Callers 1

syncFunction · 0.80

Calls 4

_setItemMethod · 0.95
_itemNameMethod · 0.95
saveMethod · 0.95
findMethod · 0.95

Tested by

no test coverage detected