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

Jump to navigation Jump to search
Line 7: Line 7:
== Writing a Tracker class ==
== Writing a Tracker class ==


Your tracker class must inherit from <tt>Tracker</tt>, which is defined in <tt>weave/engines/trackers.js</tt>.
Your tracker class must inherit from <tt>Tracker</tt>, which is defined in <tt>weave/engines/trackers.js</tt>.  Its purpose in life is to track changes to whatever data type you are syncing.  It must maintain a list of GUIDs for objects that have been changed and therefore require syncing.  It also has to maintain a "score", which is a number from 0 to 100 which represents "how badly does this data type need to be synced right now".


Your tracker has to maintain two critical pieces of information.  One is a list of GUIDs for objects that have been changed and therefore require syncing.  The other is a "score", which is a number from 0 to 100 which represents "how badly does this data type need to be synced right now".
Getting your tracker to track changes in the underlying data is probably easiest to do if you register your tracker as an observer, so that it can receive notifications from one or more Mozilla components.  What events you listen for is entirely up to you.  You can find out more about registering as an observer here:  [link].
 
You will probably want to register your tracker as an observer, to get notified by Mozilla when it does something you care about.  What events you listen for is entirely up to you.  You can find out more about registering as an observer here:  [link].


=== The Score ===
=== The Score ===
1,007

edits

Navigation menu