1,007
edits
Changes
→Example Store class skeleton
__proto__: Store.prototype,
_logName: "foo",
itemExists: function(idguid) { // Return true if an item with given guid = id exists in the store.
},
createRecord: function(idguid) { // Return the cached one if we have it: let record = this has something to do with WBOs?.cache.get(guid); if (record) return record; // Otherwise, instantiate: record = new FooRecord(); // now sets Set the data and the guid on it: record.bar = 17; // or whatever record .id= guid; // use utils.makeGuid Add it to create the cache: this.cache.put(guid for something, record);
// return the record
},
changeItemId: function(oldId, newId) {
},
getAllIds: function() {
// Return a dictionary-style object...list of the GUIDs of all items
},
wipe: function() {
},
create: function(record) {
// Create a new item based on the values in record
},
update: function(record) {
// look up the stored record with id = record.id, then set // its values to those of new record
},
remove: function(record) {
// look up the stored record with id = record.id, then delete it.
}
};