CloudServices/Sync/FxSync/Developer/ClientAPI: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 148: Line 148:
   __proto__: Store.prototype,
   __proto__: Store.prototype,
   _logName: "foo",
   _logName: "foo",
   itemExists: function(id) {
   itemExists: function(guid) {
     // Return true if an item with guid = id exists in the store.
     // Return true if an item with given guid exists in the store.
   },
   },
   createRecord: function(id) {
   createRecord: function(guid) {
     // this has something to do with WBOs?
     // Return the cached one if we have it:
     // now sets the record id
    let record = this.cache.get(guid);
     // use utils.makeGuid to create the guid for something
    if (record)
      return record;
    // Otherwise, instantiate:
    record = new FooRecord();
     // Set the data and the guid on it:
    record.bar = 17; // or whatever
    record.id = guid;
     // Add it to the cache:
    this.cache.put(guid, record);
     // return the record
     // return the record
  },
     return record;
  createMetaRecords: function(guid, items) {
     // Return... what exactly?
   },
   },
   changeItemId: function(oldId, newId) {
   changeItemId: function(oldId, newId) {
Line 164: Line 170:
   },
   },
   getAllIds: function() {
   getAllIds: function() {
     // Return a dictionary-style object...
     // Return a list of the GUIDs of all items
   },
   },
   wipe: function() {
   wipe: function() {
Line 170: Line 176:
   },
   },
   create: function(record) {
   create: function(record) {
      
     // Create a new item based on the values in record
   },
   },
   update: function(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) {
   remove: function(record) {
      
     // look up the stored record with id = record.id, then delete it.
   }
   }
  };
  };
1,007

edits

Navigation menu