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

Line 272: Line 272:


== Installing your classes into Weave ==
== Installing your classes into Weave ==
In the file <tt>weave/chrome/content/fx-weave-overlay.js</tt>, find the function <tt>FxWeaveGlue()</tt>, and within the <tt>try</tt> block import your Engine class, instantiate it, and register it with Weave.  Like so:
function FxWeaveGlue() {
  //... etc ...
  try {
    Cu.import("resource://weave/engines/bookmarks.js");
    Weave.Engines.register(new BookmarksEngine());
    Cu.import("resource://weave/engines/history.js");
    Weave.Engines.register(new HistoryEngine());
    //.. etc ...
    // Your engine here:
    Cu.import("resource://weave/engines/foo.js");
    Weave.Engines.register(new FooEngine());
  } catch (e) {
  //... etc ...
To make your engine work in Fennec, you must also add the same code to the function <tt>FennecWeaveGlue()</tt> in the file <tt>weave/chrome/content/fennec-weave-overlay.js</tt>.


== Updating the Weave preferences screen ==
== Updating the Weave preferences screen ==
1,007

edits