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

Jump to navigation Jump to search
Line 52: Line 52:


== Writing a Store class ==
== Writing a Store class ==
=== Example Store class skeleton ===
<pre>
function FooStore() {
  // Maintains the store of all your Foo-type items and their GUIDs.
}
FooStore.prototype = {
  __proto__: Store.prototype,
  _logName: "foo",
  _lookup: "huh",
  itemExists: function(id) {
    // Return true if an item with guid = id exists in the store.
  },
  createRecord: function(id) {
    // this has something to do with WBOs?
    // now sets the record id
    // use utils.makeGuid to create the guid for something
    // return the record
  },
  createMetaRecords: function(guid, items) {
    // Return... what exactly?
  },
  changeItemId: function(oldId, newId) {
    // Find the item with guid = oldId and change its guid to newId.
  },
  getAllIds: function() {
    // Return a dictionary-style object...
  },
  wipe: function() {
    // Delete everything!
  },
  create: function(record) {
   
  },
  update: function(record) {
   
  },
  remove: function(record) {
   
  }
};
</pre>


== Writing a Tracker class ==
== Writing a Tracker class ==
1,007

edits

Navigation menu